Skip to content

Check the result of PySet_Contains() for error in Python/symtable.c #109146

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

Conversation

serhiy-storchaka
Copy link
Member

No description provided.

@serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error skip issue skip news interpreter-core (Objects, Python, Grammar, and Parser dirs) needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Sep 8, 2023
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM.

@@ -543,14 +544,22 @@ analyze_name(PySTEntryObject *ste, PyObject *scopes, PyObject *name, long flags,
"nonlocal declaration not allowed at module level");
return error_at_directive(ste, name);
Copy link
Member

Choose a reason for hiding this comment

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

Remark unrelated to you PR. I don't understand why an exception is raised before calling error_at_directive() which seems to always override the current exception (and not chain the new one to the currently raised one).

Copy link
Member Author

Choose a reason for hiding this comment

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

No, it only sets location in the raised SyntaxError.

Copy link
Member

Choose a reason for hiding this comment

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

I looked again at PyErr_SyntaxLocationObjectEx(): oh, you're right. Now it makes sense, thanks :-)

@miss-islington
Copy link
Contributor

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

@serhiy-storchaka serhiy-storchaka deleted the symtable-PySet_Contains branch September 8, 2023 16:57
@miss-islington
Copy link
Contributor

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 87a7faf6b68c8076e640a9a1347a255f132d8382 3.11

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 8, 2023
@bedevere-bot
Copy link

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

@bedevere-bot bedevere-bot removed the needs backport to 3.12 only security fixes label Sep 8, 2023
@vstinner
Copy link
Member

vstinner commented Sep 8, 2023

Nice fix, it's good to check for errors :-)

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Sep 8, 2023
…ble.c (pythonGH-109146).

(cherry picked from commit 87a7faf)

Co-authored-by: Serhiy Storchaka <[email protected]>
@bedevere-bot
Copy link

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

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Sep 8, 2023
serhiy-storchaka added a commit that referenced this pull request Sep 8, 2023
Yhg1s pushed a commit that referenced this pull request Oct 2, 2023
…ble.c (GH-109146) (#109153)

Check the result of PySet_Contains() for error in Python/symtable.c (GH-109146)
(cherry picked from commit 87a7faf)

Co-authored-by: Serhiy Storchaka <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) skip issue skip news type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants