-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fix parser when using Python 3.9 #8716
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
Conversation
The structure of the AST for subscripts was changed in python/cpython#9605 Fixes #8627
Hm, there are some errors in the 3.9 test run. Let me look into these. |
Okay, there are some remaining Python 3.9 test failures, but they seem to be just cases where Python 3.9 somehow produces different output. Examples:
(The new parser produces a better error message for duplicate keyword args.) Also a few parse trees are different, e.g.:
(The old parser didn't have a line or column number for certain Tuples.) Finally:
Seems the two error lines are produced in a different order. |
@@ -233,6 +233,8 @@ def clean_up(a: List[str]) -> List[str]: | |||
remove trailing carriage returns. | |||
""" | |||
res = [] | |||
pwd = os.getcwd() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was going on here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many tests suddenly showed the full pathname in the traceback instead of simply File "driver.py", line NNN
. I don't actually know why, but I could imagine that somehow an absolute path was computed by Python where it previously believed the pathname on the command line? It's always about "driver.py" which I presume is the synthetic script created by the test harness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Playing around, this just seems new behavior in Python 3.9, so I think my fix is the best we can do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks good!
I'm not actually sure if we have any kind of principled way to deal with version mismatches like this; I think we normally just hack around it... We could add -only_post_39
and -only_pre_39
magic test name suffixes to split_test_cases
, I guess, or just disable or tweak the tests.
The daemon one is bizarre and probably needs real investigation; maybe its something involving the interleaving of stdout and stderr?
Merging now, we can iterate later. |
Opened #8743 for fixing parse trees. |
The structure of the AST for subscripts was changed in
python/cpython#9605
Fixes #8627
Also fix the majority of the errors produced when running pytest with Python 3.9, but not all.