GeezerVison is showing github.com — gh-118814: Fix crash in `_PyArg_UnpackKeywordsWithVararg` by picnixz · Pull Request #122558 · python/cpython
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
Uh oh!
There was an error while loading. Please reload this page.
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
047d18e
Fix _PyArg_UnpackKeywordsWithVararg().
picnixz Aug 1, 2024
15fc804
add test
picnixz Aug 1, 2024
0e601bf
add tests
picnixz Aug 1, 2024
46e511e
regenerate objects
picnixz Aug 1, 2024
078e9f7
blurb
picnixz Aug 1, 2024
f13fa45
use better names
picnixz Aug 1, 2024
a4cd890
update global objects
picnixz Aug 1, 2024
c21014e
fix parsing
picnixz Aug 2, 2024
c8accdc
add tests
picnixz Aug 2, 2024
659d823
remove unused code
picnixz Aug 2, 2024
b70263a
fixup ws
picnixz Aug 2, 2024
a59ff66
simplify buffer's creation
picnixz Aug 4, 2024
bbd353c
Use multi-line comments to have collapsible sections
picnixz Aug 4, 2024
b85c199
Merge branch 'main' into ac-typevar-crash
picnixz Aug 4, 2024
File filter
Filter by extension
.c
(1)
.h
(1)
.py
(1)
All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Hide whitespace
Diff view
Hide whitespace
add tests
Loading branch information
Uh oh!
There was an error while loading. Please reload this page.
commit 0e601bf9f7fa89427d3f96d85f86faabbf2af2b6
There are no files selected for viewing
Original file line number
Diff line number
Diff line change
Expand Up
@@ -3340,6 +3340,17 @@ def test_vararg_with_default(self):
self.assertEqual(ac_tester.vararg_with_default(1, 2, 3, 4), (1, (2, 3, 4), False))
self.assertEqual(ac_tester.vararg_with_default(1, 2, 3, 4, b=True), (1, (2, 3, 4), True))
self.assertEqual(ac_tester.vararg_with_default(a=1, b=False), (1, (), False))
self.assertEqual(ac_tester.vararg_with_default(b=False, a=1), (1, (), False))
def test_vararg_with_multiple_defaults(self):
func = ac_tester.vararg_with_multiple_defaults
with self.assertRaises(TypeError):
func()
self.assertEqual(func(1, b1=True), (1, (), True, False, False))
self.assertEqual(func(1, 2, 3, 4), (1, (2, 3, 4), False, False, False))
self.assertEqual(func(1, 2, 3, 4, b1=True), (1, (2, 3, 4), True, False, False))
self.assertEqual(func(a=1, b1=True), (1, (), True, False, False))
self.assertEqual(func(b1=True, a=1), (1, (), True, False, False))
def test_vararg_with_only_defaults(self):
self.assertEqual(ac_tester.vararg_with_only_defaults(), ((), None))
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -1033,6 +1033,29 @@ vararg_with_default_impl(PyObject *module, PyObject *a, PyObject *args,
}
/*[clinic input]
vararg_with_multiple_defaults
a: object
*args: object
b1: bool = False
b2: bool = False
b3: bool = False
[clinic start generated code]*/
static PyObject *
vararg_with_multiple_defaults_impl(PyObject *module, PyObject *a,
PyObject *args, int b1, int b2, int b3)
/*[clinic end generated code: output=66087a6689e6bee5 input=66e4b2858ad13769]*/
{
PyObject *obj_b1 = b1 ? Py_True : Py_False;
PyObject *obj_b2 = b2 ? Py_True : Py_False;
PyObject *obj_b3 = b3 ? Py_True : Py_False;
return pack_arguments_newref(5, a, args, obj_b1, obj_b2, obj_b3);
}
/*[clinic input]
vararg_with_only_defaults
Expand Down
Expand Up
@@ -1907,6 +1930,7 @@ static PyMethodDef tester_methods[] = {
VARARG_AND_POSONLY_METHODDEF
VARARG_METHODDEF
VARARG_WITH_DEFAULT_METHODDEF
VARARG_WITH_MULTIPLE_DEFAULTS_METHODDEF
VARARG_WITH_ONLY_DEFAULTS_METHODDEF
GH_32092_OOB_METHODDEF
GH_32092_KW_PASS_METHODDEF
Expand Down
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.