bpo-44201: Avoid side effects of "invalid_*" rules in the REPL#26298
Merged
pablogsal merged 5 commits intopython:mainfrom May 22, 2021
Merged
bpo-44201: Avoid side effects of "invalid_*" rules in the REPL#26298pablogsal merged 5 commits intopython:mainfrom
pablogsal merged 5 commits intopython:mainfrom
Conversation
When the parser does a second pass to check for errors, these rules can have some small side-effects as they may advance the parser more than the point reached in the first pass. This can cause the tokenizer to ask for extra tokens in interactive mode causing the tokenizer to show the prompt instead of failing instantly. To avoid this, add a new mode to the tokenizer that is activated in the second pass and deactivates asking for new tokens when the interactive line is finished. As the parsing should have reached the last line in the first pass, the second pass should not need to ask for more tokens.
Contributor
erlend-aasland
left a comment
There was a problem hiding this comment.
Minor speling nitpicks
Misc/NEWS.d/next/Core and Builtins/2021-05-21-21-16-03.bpo-44201.bGaSjt.rst
Outdated
Show resolved
Hide resolved
lysnikolaou
approved these changes
May 22, 2021
…01.bGaSjt.rst Co-authored-by: Erlend Egeberg Aasland <[email protected]>
Co-authored-by: Erlend Egeberg Aasland <[email protected]>
erlend-aasland
approved these changes
May 22, 2021
Contributor
|
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
May 22, 2021
…nGH-26298) When the parser does a second pass to check for errors, these rules can have some small side-effects as they may advance the parser more than the point reached in the first pass. This can cause the tokenizer to ask for extra tokens in interactive mode causing the tokenizer to show the prompt instead of failing instantly. To avoid this, add a new mode to the tokenizer that is activated in the second pass and deactivates asking for new tokens when the interactive line is finished. As the parsing should have reached the last line in the first pass, the second pass should not need to ask for more tokens. (cherry picked from commit bd7476d) Co-authored-by: Pablo Galindo <[email protected]>
|
GH-26313 is a backport of this pull request to the 3.10 branch. |
Member
Author
|
Thanks for the reviews @erlend-aasland and @lysnikolaou! |
pablogsal
added a commit
that referenced
this pull request
May 22, 2021
) (GH-26313) When the parser does a second pass to check for errors, these rules can have some small side-effects as they may advance the parser more than the point reached in the first pass. This can cause the tokenizer to ask for extra tokens in interactive mode causing the tokenizer to show the prompt instead of failing instantly. To avoid this, add a new mode to the tokenizer that is activated in the second pass and deactivates asking for new tokens when the interactive line is finished. As the parsing should have reached the last line in the first pass, the second pass should not need to ask for more tokens. (cherry picked from commit bd7476d) Co-authored-by: Pablo Galindo <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://bugs.python.org/issue44201
When the parser does a second pass to check for errors, these rules can
have some small side-effects as they may advance the parser more than
the point reached in the first pass. This can cause the tokenizer to ask
for extra tokens in interactive mode causing the tokenizer to show the
prompt instead of failing instantly.
To avoid this, add a new mode to the tokenizer that is activated in the
second pass and deactivates asking for new tokens when the interactive
line is finished. As the parsing should have reached the last line in
the first pass, the second pass should not need to ask for more tokens.