Bug 1788073 - python-parso fails to build with Python 3.9: An exception message has changed, tests fail for that
Summary: python-parso fails to build with Python 3.9: An exception message has changed...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-parso
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Carl George 🤠
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON39
TreeView+ depends on / blocked
 
Reported: 2020-01-06 10:25 UTC by Miro Hrončok
Modified: 2020-03-18 10:37 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-18 02:55:25 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Miro Hrončok 2020-01-06 10:25:18 UTC
python-parso fails to build with Python 3.9.0a2.

+ py.test-3.9 --verbose
============================= test session starts ==============================
platform linux -- Python 3.9.0a2, pytest-4.6.9, py-1.8.0, pluggy-0.13.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /builddir/build/BUILD/parso-0.5.1, inifile: pytest.ini, testpaths: parso, test
collected 1053 items / 3 errors / 1050 selected                                

==================================== ERRORS ====================================
__________________ ERROR collecting test/fuzz_diff_parser.py ___________________
parso/grammar.py:242: in load_grammar
    return _loaded_grammars[path]
E   KeyError: '/builddir/build/BUILD/parso-0.5.1/parso/python/grammar39.txt'

During handling of the above exception, another exception occurred:
parso/grammar.py:245: in load_grammar
    with open(path) as f:
E   FileNotFoundError: [Errno 2] No such file or directory: '/builddir/build/BUILD/parso-0.5.1/parso/python/grammar39.txt'

During handling of the above exception, another exception occurred:
test/fuzz_diff_parser.py:33: in <module>
    from test.test_diff_parser import _check_error_leaves_nodes
<frozen importlib._bootstrap>:993: in _find_and_load
    ???
<frozen importlib._bootstrap>:977: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:655: in _load_unlocked
    ???
<frozen importlib._bootstrap>:618: in _load_backward_compatible
    ???
/usr/lib/python3.9/site-packages/_pytest/assertion/rewrite.py:304: in load_module
    exec(co, mod.__dict__)
test/test_diff_parser.py:42: in <module>
    class Differ(object):
test/test_diff_parser.py:43: in Differ
    grammar = load_grammar()
parso/grammar.py:256: in load_grammar
    return load_grammar(**kwargs)
parso/grammar.py:252: in load_grammar
    raise NotImplementedError(message)
E   NotImplementedError: Python version None is currently not supported.
__________________ ERROR collecting test/test_diff_parser.py ___________________
parso/grammar.py:242: in load_grammar
    return _loaded_grammars[path]
E   KeyError: '/builddir/build/BUILD/parso-0.5.1/parso/python/grammar39.txt'

During handling of the above exception, another exception occurred:
parso/grammar.py:245: in load_grammar
    with open(path) as f:
E   FileNotFoundError: [Errno 2] No such file or directory: '/builddir/build/BUILD/parso-0.5.1/parso/python/grammar39.txt'

During handling of the above exception, another exception occurred:
test/test_diff_parser.py:42: in <module>
    class Differ(object):
test/test_diff_parser.py:43: in Differ
    grammar = load_grammar()
parso/grammar.py:256: in load_grammar
    return load_grammar(**kwargs)
parso/grammar.py:252: in load_grammar
    raise NotImplementedError(message)
E   NotImplementedError: Python version None is currently not supported.
__________________ ERROR collecting test/test_diff_parser.py ___________________
parso/grammar.py:242: in load_grammar
    return _loaded_grammars[path]
E   KeyError: '/builddir/build/BUILD/parso-0.5.1/parso/python/grammar39.txt'

During handling of the above exception, another exception occurred:
parso/grammar.py:245: in load_grammar
    with open(path) as f:
E   FileNotFoundError: [Errno 2] No such file or directory: '/builddir/build/BUILD/parso-0.5.1/parso/python/grammar39.txt'

During handling of the above exception, another exception occurred:
test/test_diff_parser.py:42: in <module>
    class Differ(object):
test/test_diff_parser.py:43: in Differ
    grammar = load_grammar()
parso/grammar.py:256: in load_grammar
    return load_grammar(**kwargs)
parso/grammar.py:252: in load_grammar
    raise NotImplementedError(message)
E   NotImplementedError: Python version None is currently not supported.
!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!
=========================== 3 error in 0.95 seconds ============================

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

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

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, but the initial bootstrapping has already started.
A build failure this early in the bootstrap sequence blocks us very much.

Comment 1 Carl George 🤠 2020-01-06 22:05:19 UTC
I've updated the package to 0.5.2, which should resolve this.

https://bodhi.fedoraproject.org/updates/FEDORA-2020-09870f81de

Comment 2 Miro Hrončok 2020-01-06 23:56:28 UTC
Indeed. Thanks.

Comment 3 Miro Hrončok 2020-01-29 22:18:47 UTC
python-parso fails to build with Python 3.9.0a3:

_______________ test_python_exception_matches[(lambda: x := 1)] ________________
code = '(lambda: x := 1)'
    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert 'SyntaxError: cannot use named assignment with lambda' in ['SyntaxError: cannot use assignment expressions with lambda']
test/test_python_errors.py:39: AssertionError
______________ test_python_exception_matches[((lambda: x) := 1)] _______________
code = '((lambda: x) := 1)'
    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert 'SyntaxError: cannot use named assignment with lambda' in ['SyntaxError: cannot use assignment expressions with lambda']
test/test_python_errors.py:39: AssertionError
__________________ test_python_exception_matches[(a[i] := x)] __________________
code = '(a[i] := x)'
    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert 'SyntaxError: cannot use named assignment with subscript' in ['SyntaxError: cannot use assignment expressions with subscript']
test/test_python_errors.py:39: AssertionError
_________________ test_python_exception_matches[((a[i]) := x)] _________________
code = '((a[i]) := x)'
    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert 'SyntaxError: cannot use named assignment with subscript' in ['SyntaxError: cannot use assignment expressions with subscript']
test/test_python_errors.py:39: AssertionError
__________________ test_python_exception_matches[(a(i) := x)] __________________
code = '(a(i) := x)'
    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert 'SyntaxError: cannot use named assignment with function call' in ['SyntaxError: cannot use assignment expressions with function call']
test/test_python_errors.py:39: AssertionError
__________________ test_python_exception_matches[(a.b := c)] ___________________
code = '(a.b := c)'
    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert 'SyntaxError: cannot use named assignment with attribute' in ['SyntaxError: cannot use assignment expressions with attribute']
test/test_python_errors.py:39: AssertionError
_____ test_python_exception_matches[[(i.i:= 0) for ((i), j) in range(5)]] ______
code = '[(i.i:= 0) for ((i), j) in range(5)]'
    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert 'SyntaxError: cannot use named assignment with attribute' in ['SyntaxError: cannot use assignment expressions with attribute']
test/test_python_errors.py:39: AssertionError
________________ test_python_exception_matches[(await a := x)] _________________
code = '(await a := x)'
    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert 'SyntaxError: cannot use named assignment with await expression' in ['SyntaxError: cannot use assignment expressions with await expression']
test/test_python_errors.py:39: AssertionError
_______________ test_python_exception_matches[((await a) := x)] ________________
code = '((await a) := x)'
    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert 'SyntaxError: cannot use named assignment with await expression' in ['SyntaxError: cannot use assignment expressions with await expression']
test/test_python_errors.py:39: AssertionError

Comment 4 Ben Cotton 2020-02-11 17:22:45 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 32 development cycle.
Changing version to 32.

Comment 5 Miro Hrončok 2020-03-16 12:39:34 UTC
Carl, could you please have look and report this upstream if needed? Thanks.

Comment 6 Miro Hrončok 2020-03-16 18:30:18 UTC
Setting the severity to high.

This package is part of the initial bootstrap sequence. Without it, we cannot proceed with the bootstrap in a Koji side tag.

https://fedoraproject.org/wiki/Changes/Python3.9#Important_dates_and_plan

The current plan is to follow the "ideal point when we can start rebuilding in Koji" -- that is we need to get this bug fixed approximately in 2 months.

That includes potential uncovered bugs in packages that depend on this one.

Please knowledge that you have read this message and that you can dedicate time to fix it. If you know already that you won't be able to fix it by the deadline, please let us know ASAP, so we can allocate resources to do that. Thank You.

(This comment is posted to multiple Bugzillas, please forgive me if it's not 100% accurate.)

Comment 7 Carl George 🤠 2020-03-18 02:55:25 UTC
It was also failing to build on Rawhide with Python 3.8.2.  I was able to track down this error to an upstream issue.  I was able to sort it out by updating to the latest version and adding a patch for an upstream commit right after that version.

https://github.com/davidhalter/parso/issues/103
https://github.com/davidhalter/parso/commit/0234a70e95199d4b9bb257d9ea7a5fcb8baa8c91

This fixed building against Python 3.8.2 in Rawhide as well as 3.9.0~a4 in the @python/python3.9 COPR.

https://bodhi.fedoraproject.org/updates/FEDORA-2020-261d3eca01

Comment 8 Miro Hrončok 2020-03-18 10:37:36 UTC
Awesome, thanks!


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