Bug 2051510 - python-lxml fails to build with Python 3.11: AssertionError: -1 != 0
Summary: python-lxml fails to build with Python 3.11: AssertionError: -1 != 0
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-lxml
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Igor Raits
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.11
TreeView+ depends on / blocked
 
Reported: 2022-02-07 11:50 UTC by Tomáš Hrnčiar
Modified: 2022-06-22 11:49 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-06-22 11:49:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2022-02-07 11:50:44 UTC
python-lxml fails to build with Python 3.11.0a4.

======================================================================
FAIL: test_element_cyclic_gc_none (lxml.tests.test_errors.ErrorTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.11/unittest/case.py", line 57, in testPartExecutor
    yield
    ^^^^^
  File "/usr/lib64/python3.11/unittest/case.py", line 591, in run
    self._callTestMethod(testMethod)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/unittest/case.py", line 547, in _callTestMethod
    if method() is not None:
       ^^^^^^^^
  File "/builddir/build/BUILD/lxml-4.7.1/src/lxml/tests/test_errors.py", line 48, in test_element_cyclic_gc_none
    self.assertEqual(count, 0)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/unittest/case.py", line 841, in assertEqual
    assertion_func(first, second, msg=msg)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/unittest/case.py", line 834, in _baseAssertEqual
    raise self.failureException(msg)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: -1 != 0

----------------------------------------------------------------------
Ran 1948 tests in 4.756s

FAILED (failures=1)

https://docs.python.org/3.11/whatsnew/3.11.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/03351304-python-lxml/

For all our attempts to build python-lxml with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-lxml/

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.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
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 Ben Cotton 2022-02-08 20:10:09 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 2 Miro Hrončok 2022-02-12 15:16:22 UTC
The test is:

    def test_element_cyclic_gc_none(self):
        # test if cyclic reference can crash etree
        Element = self.etree.Element
        getrefcount = sys.getrefcount

        # must disable tracing as it could change the refcounts
        trace_func = sys.gettrace()
        try:
            sys.settrace(None)
            gc.collect()

            count = getrefcount(None)

            l = [Element('name'), Element('name')]
            l.append(l)

            del l
            gc.collect()
            count = getrefcount(None) - count

            self.assertEqual(count, 0)          <---   this assert fails, count is -1
        finally:
            sys.settrace(trace_func)

Tomáš, this is from a build with Cython 3 alpha? Does that same test fail on Python 3.10 with Cython 3 alpha?

Comment 3 Tomáš Hrnčiar 2022-02-14 08:32:37 UTC
(In reply to Miro Hrončok from comment #2)

> Tomáš, this is from a build with Cython 3 alpha? 

Yes

> Does that same test fail on Python 3.10 with Cython 3 alpha?

No, test and also whole build passed. Hence I opened this bugzilla, because it seemed that the problem is in Python 3.11 and not in Cython 3 used for this build.

Comment 4 Miro Hrončok 2022-06-22 11:49:14 UTC
Closing this in bulk as it built with Python 3.11. If this needs to remain open for a followup, feel free to reopen, I won't close in bulk again.


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