Bug 1830799

Summary: babel fails to build with Python 3.9: test_util.py test failures
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: babelAssignee: Felix Schwarz <fschwarz>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: cstratak, fschwarz, mhroncok, mplch, nphilipp
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-05 08:35:19 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: 1785415    

Description Miro Hrončok 2020-05-03 22:42:54 UTC
babel fails to build with Python 3.9.0a6:

=================================== FAILURES ===================================
_ test_parse_future[\nfrom __future__ import print_function,\n    division, with_statement,\n    unicode_literals\n-237568] _
source = '\nfrom __future__ import print_function,\n    division, with_statement,\n    unicode_literals\n'
result = 237568
    @pytest.mark.parametrize('source, result', [
        ('''
    from __future__ import print_function,
        division, with_statement,
        unicode_literals
    ''', 0x10000 | 0x2000 | 0x8000 | 0x20000),
        ('''
    from __future__ import print_function, division
    print('hello')
    ''', 0x10000 | 0x2000),
        ('''
    from __future__ import print_function, division, unknown,,,,,
    print 'hello'
    ''', 0x10000 | 0x2000),
        ('''
    from __future__ import (
        print_function,
        division)
    ''', 0x10000 | 0x2000),
        ('''
    from __future__ import \\
        print_function, \\
        division
    ''', 0x10000 | 0x2000),
    ])
    def test_parse_future(source, result):
        fp = BytesIO(source.encode('latin-1'))
        flags = parse_future_flags(fp)
>       assert flags == result
E       assert 3801088 == 237568
tests/test_util.py:96: AssertionError
_ test_parse_future[\nfrom __future__ import print_function, division\nprint('hello')\n-73728] _
source = "\nfrom __future__ import print_function, division\nprint('hello')\n"
result = 73728
    @pytest.mark.parametrize('source, result', [
        ('''
    from __future__ import print_function,
        division, with_statement,
        unicode_literals
    ''', 0x10000 | 0x2000 | 0x8000 | 0x20000),
        ('''
    from __future__ import print_function, division
    print('hello')
    ''', 0x10000 | 0x2000),
        ('''
    from __future__ import print_function, division, unknown,,,,,
    print 'hello'
    ''', 0x10000 | 0x2000),
        ('''
    from __future__ import (
        print_function,
        division)
    ''', 0x10000 | 0x2000),
        ('''
    from __future__ import \\
        print_function, \\
        division
    ''', 0x10000 | 0x2000),
    ])
    def test_parse_future(source, result):
        fp = BytesIO(source.encode('latin-1'))
        flags = parse_future_flags(fp)
>       assert flags == result
E       assert 1179648 == 73728
tests/test_util.py:96: AssertionError
_ test_parse_future[\nfrom __future__ import print_function, division, unknown,,,,,\nprint 'hello'\n-73728] _
source = "\nfrom __future__ import print_function, division, unknown,,,,,\nprint 'hello'\n"
result = 73728
    @pytest.mark.parametrize('source, result', [
        ('''
    from __future__ import print_function,
        division, with_statement,
        unicode_literals
    ''', 0x10000 | 0x2000 | 0x8000 | 0x20000),
        ('''
    from __future__ import print_function, division
    print('hello')
    ''', 0x10000 | 0x2000),
        ('''
    from __future__ import print_function, division, unknown,,,,,
    print 'hello'
    ''', 0x10000 | 0x2000),
        ('''
    from __future__ import (
        print_function,
        division)
    ''', 0x10000 | 0x2000),
        ('''
    from __future__ import \\
        print_function, \\
        division
    ''', 0x10000 | 0x2000),
    ])
    def test_parse_future(source, result):
        fp = BytesIO(source.encode('latin-1'))
        flags = parse_future_flags(fp)
>       assert flags == result
E       assert 1179648 == 73728
tests/test_util.py:96: AssertionError
_ test_parse_future[\nfrom __future__ import (\n    print_function,\n    division)\n-73728] _
source = '\nfrom __future__ import (\n    print_function,\n    division)\n'
result = 73728
    @pytest.mark.parametrize('source, result', [
        ('''
    from __future__ import print_function,
        division, with_statement,
        unicode_literals
    ''', 0x10000 | 0x2000 | 0x8000 | 0x20000),
        ('''
    from __future__ import print_function, division
    print('hello')
    ''', 0x10000 | 0x2000),
        ('''
    from __future__ import print_function, division, unknown,,,,,
    print 'hello'
    ''', 0x10000 | 0x2000),
        ('''
    from __future__ import (
        print_function,
        division)
    ''', 0x10000 | 0x2000),
        ('''
    from __future__ import \\
        print_function, \\
        division
    ''', 0x10000 | 0x2000),
    ])
    def test_parse_future(source, result):
        fp = BytesIO(source.encode('latin-1'))
        flags = parse_future_flags(fp)
>       assert flags == result
E       assert 1179648 == 73728
tests/test_util.py:96: AssertionError
_ test_parse_future[\nfrom __future__ import \\\n    print_function, \\\n    division\n-73728] _
source = '\nfrom __future__ import \\\n    print_function, \\\n    division\n'
result = 73728
    @pytest.mark.parametrize('source, result', [
        ('''
    from __future__ import print_function,
        division, with_statement,
        unicode_literals
    ''', 0x10000 | 0x2000 | 0x8000 | 0x20000),
        ('''
    from __future__ import print_function, division
    print('hello')
    ''', 0x10000 | 0x2000),
        ('''
    from __future__ import print_function, division, unknown,,,,,
    print 'hello'
    ''', 0x10000 | 0x2000),
        ('''
    from __future__ import (
        print_function,
        division)
    ''', 0x10000 | 0x2000),
        ('''
    from __future__ import \\
        print_function, \\
        division
    ''', 0x10000 | 0x2000),
    ])
    def test_parse_future(source, result):
        fp = BytesIO(source.encode('latin-1'))
        flags = parse_future_flags(fp)
>       assert flags == result
E       assert 1179648 == 73728
tests/test_util.py:96: AssertionError


For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.9/fedora-rawhide-x86_64/01365332-babel/

For all our attempts to build babel with Python 3.9, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/package/babel/

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

Let us know here if you have any questions.

Python 3.9 will be included in Fedora 33. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.9.
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 Miro Hrončok 2020-05-04 18:21:15 UTC
babel is very early in the bootstrap sequence, raising severity.

Comment 2 Felix Schwarz 2020-05-04 20:06:14 UTC
I noticed at least one Python 3.9-related error when doing the setup procedure with an upstream git repo ("AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator'") so I guess we need some fixes upstream.

I was a babel developer once but don't have that much time right now so I'd appreciate help.

@Nils: Do you have some cycles to check this out?

@Miro: This is the first time I became aware that Babel might be need changes for Python 3.9. Did I miss something?

Comment 3 Felix Schwarz 2020-05-04 20:14:36 UTC
I opened an upstream issue (https://github.com/python-babel/babel/issues/709) - maybe we get some attention to the problem. Still I can't promise a lot of work to debug this.

Comment 4 Miro Hrončok 2020-05-04 20:39:32 UTC
> @Miro: This is the first time I became aware that Babel might be need changes for Python 3.9. Did I miss something?

Not at all. https://copr.fedorainfracloud.org/coprs/g/python/python3.9/package/babel/ shows that it built pretty good so far.

Comment 5 Felix Schwarz 2020-05-04 20:58:49 UTC
I sent a pull request for the import problem (not related to Fedora's build failure but maybe helpful if you try to debug the issue): https://github.com/python-babel/babel/pull/710

Comment 6 Felix Schwarz 2020-05-04 21:15:44 UTC
probably not interesting but I wanted to add that babel 2.8.0 still works for me with Python 3.9 on Fedora 31. However you need "export TZ='UTC'" before running the test suite.

Comment 7 Felix Schwarz 2020-05-05 08:19:35 UTC
Actually this was not so hard to fix so I submitted a pull request upstream: https://github.com/python-babel/babel/pull/712

Until upstream fixes this properly I added a patch to the Fedora package in master. Please retest.

Comment 8 Miro Hrončok 2020-05-05 08:35:19 UTC
Your commit was automatically built in https://copr.fedorainfracloud.org/coprs/g/python/python3.9/package/babel/

Thank you.