mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
gh-112438: Fix support of format units with the "e" prefix in nested tuples in PyArg_Parse (gh-112439)
This commit is contained in:
parent
812360fddd
commit
4eea1e8236
4 changed files with 40 additions and 6 deletions
|
|
@ -71,18 +71,22 @@ parse_tuple_and_keywords(PyObject *self, PyObject *args)
|
|||
|
||||
if (result) {
|
||||
int objects_only = 1;
|
||||
int count = 0;
|
||||
for (const char *f = sub_format; *f; f++) {
|
||||
if (Py_ISALNUM(*f) && strchr("OSUY", *f) == NULL) {
|
||||
objects_only = 0;
|
||||
break;
|
||||
if (Py_ISALNUM(*f)) {
|
||||
if (strchr("OSUY", *f) == NULL) {
|
||||
objects_only = 0;
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (objects_only) {
|
||||
return_value = PyTuple_New(size);
|
||||
return_value = PyTuple_New(count);
|
||||
if (return_value == NULL) {
|
||||
goto exit;
|
||||
}
|
||||
for (Py_ssize_t i = 0; i < size; i++) {
|
||||
for (Py_ssize_t i = 0; i < count; i++) {
|
||||
PyObject *arg = *(PyObject **)(buffers + i);
|
||||
if (arg == NULL) {
|
||||
arg = Py_None;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue