Bug 1898084 - python-django fails to build with Python 3.10: TypeError: ChoicesMeta.__new__() got an unexpected keyword argument 'boundary'
Summary: python-django fails to build with Python 3.10: TypeError: ChoicesMeta.__new__...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: python-django
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Matthias Runge
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2020-11-16 10:43 UTC by Miro Hrončok
Modified: 2021-02-18 23:02 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
thrnciar: needinfo+


Attachments (Terms of Use)

Description Miro Hrončok 2020-11-16 10:43:26 UTC
python-django fails to build with Python 3.10.0a2.

FAIL: test_memoryview_content (httpwrappers.tests.HttpResponseTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Django-3.1.2/tests/httpwrappers/tests.py", line 372, in test_memoryview_content
    self.assertEqual(r.content, b'memoryview')
AssertionError: b'109101109111114121118105101119' != b'memoryview'


This has been fixed upstream:

https://github.com/django/django/pull/13648


For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01756925-python-django/

For all our attempts to build python-django with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-django/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Tomáš Hrnčiar 2021-01-05 13:11:36 UTC
I tried to build python-django with 4th alpha and it seems like the above problem is not present anymore. But I ran to another test failure:

======================================================================
ERROR: model_enums.tests (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: model_enums.tests
Traceback (most recent call last):
  File "/usr/lib64/python3.10/unittest/loader.py", line 436, in _find_test_path
    module = self._get_module_from_name(name)
  File "/usr/lib64/python3.10/unittest/loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "/builddir/build/BUILD/Django-3.1.5/tests/model_enums/tests.py", line 225, in <module>
    class IPv4Network(ipaddress.IPv4Network, models.Choices):
  File "/builddir/build/BUILD/Django-3.1.5/django/db/models/enums.py", line 28, in __new__
    cls = super().__new__(metacls, classname, bases, classdict)
  File "/usr/lib64/python3.10/enum.py", line 239, in __new__
    enum_class.__bases__ = enum_class.__bases__[1:] #or (object, )
  File "/usr/lib64/python3.10/enum.py", line 483, in __setattr__
    super().__setattr__(name, value)
TypeError: __bases__ assignment: 'IPv4Network' object layout differs from '_NoInitSubclass'

https://download.copr.fedorainfracloud.org/results/@python/python3.10/fedora-rawhide-x86_64/01863009-python-django/builder-live.log.gz

Comment 2 Tomáš Hrnčiar 2021-02-08 08:48:43 UTC
Here are new failures with 5th alpha of Python 3.10 (last one should be fixed in upstream).

======================================================================
ERROR: test_integerchoices_functional_api (model_enums.tests.ChoicesTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Django-3.1.6/tests/model_enums/tests.py", line 74, in test_integerchoices_functional_api
    Place = models.IntegerChoices('Place', 'FIRST SECOND THIRD')
  File "/usr/lib64/python3.10/enum.py", line 598, in __call__
    return cls._create_(
  File "/usr/lib64/python3.10/enum.py", line 738, in _create_
    return metacls.__new__(metacls, class_name, bases, classdict, boundary=boundary)
TypeError: ChoicesMeta.__new__() got an unexpected keyword argument 'boundary'

======================================================================
ERROR: test_textchoices_functional_api (model_enums.tests.ChoicesTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Django-3.1.6/tests/model_enums/tests.py", line 115, in test_textchoices_functional_api
    Medal = models.TextChoices('Medal', 'GOLD SILVER BRONZE')
  File "/usr/lib64/python3.10/enum.py", line 598, in __call__
    return cls._create_(
  File "/usr/lib64/python3.10/enum.py", line 738, in _create_
    return metacls.__new__(metacls, class_name, bases, classdict, boundary=boundary)
TypeError: ChoicesMeta.__new__() got an unexpected keyword argument 'boundary'

======================================================================
FAIL: test_memoryview_content (httpwrappers.tests.HttpResponseTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Django-3.1.6/tests/httpwrappers/tests.py", line 372, in test_memoryview_content
    self.assertEqual(r.content, b'memoryview')
AssertionError: b'109101109111114121118105101119' != b'memoryview'

----------------------------------------------------------------------

Comment 3 Ben Cotton 2021-02-09 15:24:51 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.

Comment 4 Miro Hrončok 2021-02-18 23:02:51 UTC
I still only see:

======================================================================
FAIL: test_memoryview_content (httpwrappers.tests.HttpResponseTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Django-3.1.6/tests/httpwrappers/tests.py", line 372, in test_memoryview_content
    self.assertEqual(r.content, b'memoryview')
AssertionError: b'109101109111114121118105101119' != b'memoryview'

----------------------------------------------------------------------
Ran 13829 tests in 527.276s

In the latest Copr build.



The upstream fix is included in 3.2a1, bz1917820.


Note You need to log in before you can comment on or make changes to this bug.