Skip to content
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

Add support for Python 3.8 #675

Closed
1 task done
PCManticore opened this issue Jun 2, 2019 · 11 comments
Closed
1 task done

Add support for Python 3.8 #675

PCManticore opened this issue Jun 2, 2019 · 11 comments

Comments

@PCManticore
Copy link
Contributor

PCManticore commented Jun 2, 2019

We do have a dozen of tests currently failing on Python 3.8. We should add support for it before the official launch in autumn.

@encukou
Copy link

encukou commented Jun 11, 2019

Maintainers of Python projects are strongly encouraged to test with Python's beta and RC releases. Many projects use astroid/pylint as part of their CI; they can't fully start testing without 3.8-compatible linters.
Please consider releasing well before Python's official launch in autumn, to unblock the ecosystem and to have more time to find any remaining 3.8 bugs in both Python and astroid.

@tacaswell
Copy link

It looks like the actual parsing of the python code is delegated to typed_ast which has an open issue for supporting the new syntax python/typed_ast#118 .

@MatthijsBlom
Copy link

Here is another 3.8-related failure mode: astroid reports f"{3=}" as a syntax error.
(Feature announced here.)

It looks like the actual parsing of the python code is delegated to typed_ast which has an open issue for supporting the new syntax python/typed_ast#118 .

The README says that it will not support Python 3.8+. Instead (I think), typed_ast has been merged back into ast. (bpo-35766)

jacebrowning added a commit to jacebrowning/datafiles that referenced this issue Jul 4, 2019
@MatthijsBlom
Copy link

Seeing as typed_ast was recently merged back into ast (which is supposedly more up to date), I thought replacing imports of typed_ast with imports of ast might solve some problems.

I tried just replacing the one typed_ast.ast3 in _ast.py with simply ast. Below are test results.

Before:

> py -3.7 -m pytest astroid
= 842 passed, 43 skipped, 15 xfailed, 1 xpassed, 2 warnings in 26.57 seconds =

> py -3.8 -m pytest astroid
= 47 failed, 797 passed, 41 skipped, 15 xfailed, 1 xpassed, 2 warnings in 34.10 seconds =

After:

> py -3.8 -m pytest astroid
= 5 failed, 839 passed, 41 skipped, 15 xfailed, 1 xpassed, 2 warnings in 27.46 seconds =

While I lack any further knowledge of astroid's inner workings, this certainly looks promising to me :-)

It seems that this change fixes both positional-only arguments and debug f-strings.

@PCManticore
Copy link
Contributor Author

@MatthijsBlom Thanks for the test! We only use typed_ast for Python 3.5-3.7, not for 3.8. The errors you are seeing with py -3.8 might just be the unsupported features of Python 3.8 that astroid currently don't handle. I'm not sure though how you got these errors, as the CI is green on 3.8. Maybe you are using a particular Python 3.8 version that is not available on Travis?

@MatthijsBlom
Copy link

MatthijsBlom commented Jul 6, 2019

@PCManticore I use a fresh Python 3.8.0b2 on Windows. I ran the tests again, against commit 34bd444. Here are the complete logs: before.txt, after.txt.
(I notice the number of failures has increased in both cases.)

@PCManticore
Copy link
Contributor Author

@MatthijsBlom FWIW, I cannot reproduce these errors using the latest 3.8 beta on Mac. Not sure if these test failures are specific to Windows as I don't have access to this OS, and AppVeyor doesn't have support for Python 3.8 just yet. Is it possible to see if the latest master gives you the same amount of errors without any changes to typed_ast?

@MatthijsBlom
Copy link

@PCManticore Did you mean without changes to _ast.py? I tested a fresh 516197d; results here:
windows.txt. This time, there is only one failure. I tested on Ubuntu on WSL as well; those tests were clean.

@PCManticore
Copy link
Contributor Author

@MatthijsBlom Yes that's right. Thanks for doing that test! 28fc86f should fix that test failure for you.

@MatthijsBlom
Copy link

@PCManticore It does. No failures remaining now on my end.

@PCManticore
Copy link
Contributor Author

Thank you for testing it @MatthijsBlom I think we can close this now. My plan is to release a new version in the next two weeks, but I'll have a dev release before then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants