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

gh-112388: Fix an error that was causing the parser to try to overwrite tokenizer errors #112410

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

pablogsal
Copy link
Member

@pablogsal pablogsal commented Nov 25, 2023

…verwrite tokenizer errors

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
@carsonRadtke
Copy link
Contributor

Maybe scope creep, but is there an opportunity for an improvement here?

_PyPegen_raise_error always returns NULL - maybe it should be void.

@sunmy2019 sunmy2019 added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 27, 2023
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @sunmy2019 for commit cef5ae9 🤖

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 27, 2023
Copy link
Member

@sunmy2019 sunmy2019 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@sunmy2019
Copy link
Member

_PyPegen_raise_error always returns NULL - maybe it should be void.

We need a placeholder here. If you track the caller, it's like

void *a;
if (all_good)
    a = ...;
else
    a = _PyPegen_raise_error(...);

Copy link
Member

@lysnikolaou lysnikolaou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lysnikolaou
Copy link
Member

_PyPegen_raise_error always returns NULL - maybe it should be void.

Most of the time we assign the return value of _PyPegen_raise_error to the variable returned by the rule. This is a "hack" to set a specific error from a grammar action, but still signify to the parser that the rule has failed and it should backtrack all the way.

@pablogsal pablogsal added needs backport to 3.11 only security fixes needs backport to 3.12 bug and security fixes labels Nov 27, 2023
@pablogsal pablogsal merged commit 2c8b191 into python:main Nov 27, 2023
@pablogsal pablogsal deleted the gh-112388 branch November 27, 2023 18:36
@miss-islington-app
Copy link

Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 27, 2023
…verwrite tokenizer errors (pythonGH-112410)

(cherry picked from commit 2c8b191)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Nov 27, 2023

GH-112466 is a backport of this pull request to the 3.12 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 27, 2023
…verwrite tokenizer errors (pythonGH-112410)

(cherry picked from commit 2c8b191)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Nov 27, 2023
@bedevere-app
Copy link

bedevere-app bot commented Nov 27, 2023

GH-112467 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Nov 27, 2023
pablogsal added a commit that referenced this pull request Nov 27, 2023
…overwrite tokenizer errors (GH-112410) (#112467)

gh-112388: Fix an error that was causing the parser to try to overwrite tokenizer errors (GH-112410)
(cherry picked from commit 2c8b191)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
pablogsal added a commit that referenced this pull request Nov 27, 2023
…overwrite tokenizer errors (GH-112410) (#112466)

gh-112388: Fix an error that was causing the parser to try to overwrite tokenizer errors (GH-112410)
(cherry picked from commit 2c8b191)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
…verwrite tokenizer errors (python#112410)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
…verwrite tokenizer errors (python#112410)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
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.

5 participants