New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test failures with Python 3.9.0b1 #1441
Comments
Also visible on the CI: https://travis-ci.com/github/psf/black/jobs/338315058
|
So the problem with Python 3.8:
Python 3.9:
Edit: this is caused by the new parser. Check this:
|
Even on 3.8 this raises a SyntaxError when you run the code though:
In what context does Black generate this code? |
Yeah, I noticed that too. You get a different SyntaxError on 3.8 and 3.9, though. On 3.9 it just says "invalid syntax", not "can't use starred expression here". edit: the
but:
i.e. you can |
OK, so every Python 3.9 problem is caused by the new parser, it seems - if I run |
The 'beginning_backslash' fail seems to be because the new parser considers an empty line after a backslash to be a syntax error:
|
Just for the record, the reason the failures here are a bit obfuscated is because of the |
The issue in #1441 (comment) would seem to be a CPython bug, would you mind reporting it to CPython? |
sure, can do that. |
Filed. I actually also filed an issue for the other problem too, because it seems at least plausible to me it might be considered a bug upstream. Let's see what they say. |
Upstream calls the starred expression thing not a bug, so that will need to be addressed here somehow. |
So, I'd like to suggest a patch for the starred expression thing, but not really sure what to suggest. There's already all of these elsewhere in the file:
the two |
Oh, I didn't realize this appeared directly in |
yeah, that seems to work. I'll send a PR for that, I guess. |
As discussed in psf#1441, Python 3.9's new parser will not parse `(*starred)` even using `compile()` with the `PyCF_ONLY_AST` flag (as `ast.parse()` does), it raises a `SyntaxError`. This breaks the four tests that use this file with Python 3.9. Upstream does not consider this to be a bug - see https://bugs.python.org/issue40848#msg370643) - so we must adjust the expression. As suggested by @JelleZijlstra, this just adds a comma, which makes the new parser happy with it (the old parser is fine with this form also). Signed-off-by: Adam Williamson <awilliam@redhat.com>
As discussed in psf#1441, Python 3.9's new parser will not parse `(*starred)` even using `compile()` with the `PyCF_ONLY_AST` flag (as `ast.parse()` does), it raises a `SyntaxError`. This breaks the four tests that use this file with Python 3.9. Upstream does not consider this to be a bug - see https://bugs.python.org/issue40848#msg370643 - so we must adjust the expression. As suggested by @JelleZijlstra, this just adds a comma, which makes the new parser happy with it (the old parser is fine with this form also). Signed-off-by: Adam Williamson <awilliam@redhat.com>
…1477) As discussed in #1441, Python 3.9's new parser will not parse `(*starred)` even using `compile()` with the `PyCF_ONLY_AST` flag (as `ast.parse()` does), it raises a `SyntaxError`. This breaks the four tests that use this file with Python 3.9. Upstream does not consider this to be a bug - see https://bugs.python.org/issue40848#msg370643 - so we must adjust the expression. As suggested by @JelleZijlstra, this just adds a comma, which makes the new parser happy with it (the old parser is fine with this form also). Signed-off-by: Adam Williamson <awilliam@redhat.com>
expression tests: adjust starred expression for Python 3.9 (#1441) (#1477)
CPython 3.9 has been released and it's in our testing matrix and is passing. Unless there are Fedora specific test failures (which seems highly unlikely) and someone speaks up, I'll be closing this issue soon. |
yeah, the blank line issue was fixed upstream and the starred set thing with my PR, so this is all good. |
Describe the bug
With Python 3.9.0b1, there are test failures:
To Reproduce Steps to reproduce the behavior:
git clone psf/black && cd black
python3.9 -m venv __venv39__
. __venv39__/bin/activate
pip install -e '.[d]'
python -m unittest
Expected behavior is that tests should pass.
Environment (please complete the following information):
Does this bug also happen on master? yes (but also on the latest version)
The text was updated successfully, but these errors were encountered: