-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-118814: Fix crash in _PyArg_UnpackKeywordsWithVararg
#122558
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
Changes from 5 commits
047d18e
15fc804
0e601bf
46e511e
078e9f7
f13fa45
a4cd890
c21014e
c8accdc
659d823
b70263a
a59ff66
bbd353c
b85c199
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Fix argument parsing by ``_PyArg_UnpackKeywordsWithVararg`` when passing | ||
positional as keyword arguments before variadic arguments. Patch by Bénédikt | ||
Tran. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2589,7 +2589,13 @@ _PyArg_UnpackKeywordsWithVararg(PyObject *const *args, Py_ssize_t nargs, | |
* Otherwise, we leave a place at `buf[vararg]` for vararg tuple | ||
* so the index is `i + 1`. */ | ||
if (nargs < vararg && i != vararg) { | ||
buf[i] = current_arg; | ||
if (current_arg != NULL) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This leaves There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Urgh... yes. I should probably change the way it's being checked... like a boolean checking whether I replaced something before or not. But depending on whether you want to change the logic of this function, I may delay the commit. |
||
// It might happen that in the previous iteration, | ||
// we did "buf[i + 1] = current_arg" and that in | ||
// this current loop iteration, current_arg == NULL. | ||
// We do not want to put a NULL on a previously valid value. | ||
buf[i] = current_arg; | ||
} | ||
} | ||
else { | ||
buf[i + 1] = current_arg; | ||
|
Uh oh!
There was an error while loading. Please reload this page.