Skip to content

[3.10] bpo-44201: Avoid side effects of "invalid_*" rules in the REPL (GH-26298) #26313

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

Merged
merged 1 commit into from
May 22, 2021

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented May 22, 2021

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]

https://bugs.python.org/issue44201

…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]>
@miss-islington
Copy link
Contributor Author

@pablogsal: Status check is done, and it's a success ✅ .

@miss-islington
Copy link
Contributor Author

@pablogsal: Status check is done, and it's a success ✅ .

@pablogsal pablogsal merged commit 1fb6b9e into python:3.10 May 22, 2021
@miss-islington miss-islington deleted the backport-bd7476d-3.10 branch May 22, 2021 22:23
@miss-islington
Copy link
Contributor Author

@pablogsal: Status check is done, and it's a success ❌ .

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

Successfully merging this pull request may close these issues.

4 participants