Skip to content

[3.11] gh-94938: Fix errror detection of unexpected keyword arguments… #95353

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

@serhiy-storchaka serhiy-storchaka commented Jul 28, 2022

… (GH-94999)

When keyword argument name is an instance of a str subclass with
overloaded methods eq and hash, the former code could not find
the name of an extraneous keyword argument to report an error, and
_PyArg_UnpackKeywords() returned success without setting the
corresponding cell in the linearized arguments array. But since the number
of expected initialized cells is determined as the total number of passed
arguments, this lead to reading NULL as a keyword parameter value, that
caused SystemError or crash or other undesired behavior.
(cherry picked from commit ebad53a)

Co-authored-by: Serhiy Storchaka [email protected]

…uments (pythonGH-94999)

When keyword argument name is an instance of a str subclass with
overloaded methods __eq__ and __hash__, the former code could not find
the name of an extraneous keyword argument to report an error, and
_PyArg_UnpackKeywords() returned success without setting the
corresponding cell in the linearized arguments array. But since the number
of expected initialized cells is determined as the total number of passed
arguments, this lead to reading NULL as a keyword parameter value, that
caused SystemError or crash or other undesired behavior.
(cherry picked from commit ebad53a)

Co-authored-by: Serhiy Storchaka <[email protected]>
@bedevere-bot bedevere-bot added type-bug An unexpected behavior, bug, or error awaiting core review labels Jul 28, 2022
@serhiy-storchaka serhiy-storchaka merged commit 33efd7f into python:3.11 Jul 28, 2022
@serhiy-storchaka serhiy-storchaka deleted the backport-ebad53a-3.11 branch July 28, 2022 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants