Bug 2368973

Summary: python-sphinx fails to build with Python 3.14: test_autodoc_special_members' .. py:attribute:: Class.__annotations_cache__' != ' .. py:attribute:: Class.__annotations__'
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-sphinxAssignee: Karolina Surma <ksurma>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: aviso, cstratak, dradez, ksurma, mhroncok, python-packagers-sig
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-06-11 10:41:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2322407    

Description Karolina Surma 2025-05-28 14:50:38 UTC
python-sphinx fails to build with Python 3.14.0b2.

_________________________ test_autodoc_special_members _________________________

app = <SphinxTestApp buildername='html'>

    @pytest.mark.sphinx('html', testroot='ext-autodoc')
    def test_autodoc_special_members(app):
        # specific special methods
        options = {
            'undoc-members': None,
            'special-members': '__init__,__special1__',
        }
        actual = do_autodoc(app, 'class', 'target.Class', options)
        assert list(filter(lambda l: '::' in l, actual)) == [
            '.. py:class:: Class(arg)',
            '   .. py:method:: Class.__init__(arg)',
            '   .. py:method:: Class.__special1__()',
        ]
    
        # combination with specific members
        options = {
            'members': 'attr,docattr',
            'undoc-members': None,
            'special-members': '__init__,__special1__',
        }
        actual = do_autodoc(app, 'class', 'target.Class', options)
        assert list(filter(lambda l: '::' in l, actual)) == [
            '.. py:class:: Class(arg)',
            '   .. py:method:: Class.__init__(arg)',
            '   .. py:method:: Class.__special1__()',
            '   .. py:attribute:: Class.attr',
            '   .. py:attribute:: Class.docattr',
        ]
    
        # all special methods
        options = {
            'members': None,
            'undoc-members': None,
            'special-members': None,
        }
        if sys.version_info >= (3, 13, 0, 'alpha', 5):
            options['exclude-members'] = '__static_attributes__,__firstlineno__'
        actual = do_autodoc(app, 'class', 'target.Class', options)
>       assert list(filter(lambda l: '::' in l, actual)) == [
            '.. py:class:: Class(arg)',
            '   .. py:attribute:: Class.__annotations__',
            '   .. py:attribute:: Class.__dict__',
            '   .. py:method:: Class.__init__(arg)',
            '   .. py:attribute:: Class.__module__',
            '   .. py:method:: Class.__special1__()',
            '   .. py:method:: Class.__special2__()',
            '   .. py:attribute:: Class.__weakref__',
            '   .. py:method:: Class.a_staticmeth()',
            '   .. py:attribute:: Class.attr',
            '   .. py:method:: Class.b_staticmeth()',
            '   .. py:attribute:: Class.docattr',
            '   .. py:method:: Class.excludemeth()',
            '   .. py:attribute:: Class.inst_attr_comment',
            '   .. py:attribute:: Class.inst_attr_inline',
            '   .. py:attribute:: Class.inst_attr_string',
            '   .. py:attribute:: Class.mdocattr',
            '   .. py:method:: Class.meth()',
            '   .. py:method:: Class.moore(a, e, f) -> happiness',
            '   .. py:method:: Class.roger(a, *, b=2, c=3, d=4, e=5, f=6)',
            '   .. py:attribute:: Class.skipattr',
            '   .. py:method:: Class.skipmeth()',
            '   .. py:attribute:: Class.udocattr',
            '   .. py:method:: Class.undocmeth()',
        ]
E       AssertionError: assert ['.. py:class...al1__()', ...] == ['.. py:class...al1__()', ...]
E         
E         At index 1 diff: '   .. py:attribute:: Class.__annotations_cache__' != '   .. py:attribute:: Class.__annotations__'
E         Use -v to get more diff

tests/test_extensions/test_ext_autodoc.py:942: AssertionError

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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14-b1/fedora-rawhide-x86_64/09093376-python-sphinx/

For all our attempts to build python-sphinx with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14-b1/package/python-sphinx/

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

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
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.