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

Fully incorporate the code from Python 3.7.2 #78

Merged
merged 54 commits into from Jan 23, 2019
Merged

Fully incorporate the code from Python 3.7.2 #78

merged 54 commits into from Jan 23, 2019

Conversation

@gvanrossum
Copy link
Member

@gvanrossum gvanrossum commented Jan 19, 2019

This is a full port, following the recipe in update_process.md. I've also tried to keep the recipe up to date. I haven't cleaned up the commits, and I haven't run AppVeyor yet (I'm creating this PR to trigger the latter).

Guido van Rossum added 30 commits Jan 15, 2019
The graminit.c was built using a tweaked copy of the 3.6 pgen, with
changes from these these token.h and tokenize.c files.
Update to better (though now failing) tests, .travis.yml and .gitignore
@gvanrossum
Copy link
Member Author

@gvanrossum gvanrossum commented Jan 19, 2019

OK, this is now ready for full review. Note that I dropped support for Python 3.3 -- it's been dead long enough. I'm keeping 3.4, since it still has some life in it (though the last few Windows issues only occurred on 3.4).

@gvanrossum
Copy link
Member Author

@gvanrossum gvanrossum commented Jan 19, 2019

@gvanrossum these are the changes I made to make things build on 3.7 on Windows (more may be needed for older versions) ethanhs@8d71719

Hm... I got it working for 3.7 on Windows in the next diff. The remaining 4 diffs (PyOS_Readline through More C89) are all just to support 3.4, somehow.

@gvanrossum
Copy link
Member Author

@gvanrossum gvanrossum commented Jan 19, 2019

Does anyone want me to clean up these diffs? I suppose it's possible with creative use of git rebase -i but I'm not sure I want to spend the time doing it -- I've already spent most of this week on this, and cleaning up the diff would probably cost me another afternoon or so.

@gvanrossum gvanrossum requested a review from msullivan Jan 19, 2019
@gvanrossum
Copy link
Member Author

@gvanrossum gvanrossum commented Jan 19, 2019

I probably should add code to appveyor.yml to run pytest too.

@gvanrossum
Copy link
Member Author

@gvanrossum gvanrossum commented Jan 19, 2019

Also requesting review from @ethanhs (you're not in the python org so I can't request it from the menu).

@gvanrossum gvanrossum force-pushed the update-37 branch from b5b8534 to 8c8f9d9 Jan 20, 2019
Guido van Rossum
This code definitely isn't backwards compatible for 1.2.1,
and I'd like to reserve 1.3.0 for PR #75.

Also change for format (-dev to .dev0) to prevent complaints
from setuptools.
@gvanrossum gvanrossum force-pushed the update-37 branch from 8c8f9d9 to 69c8474 Jan 20, 2019
Guido van Rossum
@@ -0,0 +1,329 @@
#include "Python.h"

This comment has been minimized.

@msullivan

msullivan Jan 22, 2019
Collaborator

What is putting this into tools for?

This comment has been minimized.

@gvanrossum

gvanrossum Jan 22, 2019
Author Member

Oh, you should probably ignore everything I did to tools. This was an attempt at automating the update process more, but it's really not working very well yet, and I should just redo that if we even need it.

If all goes as I hope, Python 3.8 will support type comments natively, and then extracting the upstream ast module into typed_ast will be much simpler (though we'll still need to do the work to backport the code to earlier CPython versions and C89). Even if this doesn't happen, we should probably keep a branch of CPython live and only do purely mechanical transformations from there to typed_ast -- merging upstream into that branch should be simpler that the current update process.

Guido van Rossum added 2 commits Jan 22, 2019
@gvanrossum gvanrossum force-pushed the update-37 branch from 82168c0 to 0d9356f Jan 23, 2019
Copy link
Collaborator

@msullivan msullivan left a comment

This looks good! Thanks for doing this.

I've got a few requests for tests and documentation.

@@ -0,0 +1,78 @@
diff --git a/ast3/Grammar/Grammar b/ast3/Grammar/Grammar

This comment has been minimized.

@msullivan

msullivan Jan 23, 2019
Collaborator

Including these patches directly is great, both from a repeatability perspective and hopefully from a future reviewing perspective.

Could you add directions for regenerating them after future changes?

This comment has been minimized.

@msullivan

msullivan Jan 23, 2019
Collaborator

(Or, maybe per your comment about ignoring tools/, don't bother?)

ast3/tests/test_basics.py Show resolved Hide resolved
#define PyPARSE_PRINT_IS_FUNCTION 0x0004
#define PyPARSE_UNICODE_LITERALS 0x0008
#endif

#define PyPARSE_IGNORE_COOKIE 0x0010
#define PyPARSE_BARRY_AS_BDFL 0x0020
#define PyPARSE_ALWAYS_ASYNC 0x8000

This comment has been minimized.

@msullivan

msullivan Jan 23, 2019
Collaborator

Nit: make this PyPARSE_ASYNC_ALWAYS to match the struct field name?

This comment has been minimized.

@gvanrossum

gvanrossum Jan 23, 2019
Author Member

OK, will do.

@@ -1616,7 +1604,7 @@ tok_get(struct tok_state *tok, char **p_start, char **p_end)
/* async/await parsing block. */
if (tok->cur - tok->start == 5) {
/* Current token length is 5. */
if (tok->async_def) {
if (tok->async_always || tok->async_def) {

This comment has been minimized.

@msullivan

msullivan Jan 23, 2019
Collaborator

This whole async/await logic was pulled out in Python 3.7, right? Probably worth calling that out clearly in the comments.

This comment has been minimized.

@gvanrossum

gvanrossum Jan 23, 2019
Author Member

Yes, I had to put it back.

ast3/Grammar/Grammar Outdated Show resolved Hide resolved
@gvanrossum gvanrossum merged commit 156afcb into master Jan 23, 2019
4 checks passed
4 checks passed
continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@msullivan msullivan mentioned this pull request Jan 23, 2019
@gvanrossum gvanrossum deleted the update-37 branch Feb 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.