Skip to content

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

Merged
pablogsal merged 1 commit into
python:3.10from
miss-islington:backport-bd7476d-3.10
May 22, 2021
Merged

[3.10] bpo-44201: Avoid side effects of "invalid_*" rules in the REPL (GH-26298)#26313
pablogsal merged 1 commit into
python:3.10from
miss-islington:backport-bd7476d-3.10

Conversation

@miss-islington

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

Copy link
Copy Markdown
Contributor

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 Pablogsal@gmail.com

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 <Pablogsal@gmail.com>
@miss-islington

Copy link
Copy Markdown
Contributor Author

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

@miss-islington

Copy link
Copy Markdown
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
Copy Markdown
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