8000 bpo-40943: Fix skipitem() didn't raise SystemError by methane · Pull Request #25937 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-40943: Fix skipitem() didn't raise SystemError #25937

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
merged 2 commits into from
May 7, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Apply suggested change.
  • Loading branch information
methane committed May 6, 2021
commit a54b54207f1f93d8fc8fd450f41d60851a807267
5 changes: 2 additions & 3 deletions Python/getargs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2532,13 +2532,12 @@ skipitem(const char **p_format, va_list *p_va, int flags)
}
if (*format == '#') {
if (p_va != NULL) {
if (flags & FLAG_SIZE_T)
(void) va_arg(*p_va, Py_ssize_t *);
else {
if (!(flags & FLAG_SIZE_T)) {
PyErr_SetString(PyExc_SystemError,
Copy link
Member

Choose a reason for hiding this comment

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

I would rewrite this code in the form:

if (!(flags & FLAG_SIZE_T)) {
    ...
}
(void) va_arg(*p_va, Py_ssize_t *);

"PY_SSIZE_T_CLEAN macro must be defined for '#' formats");
return NULL;
}
(void) va_arg(*p_va, Py_ssize_t *);
}
format++;
} else if ((c == 's' || c == 'z' || c == 'y' || c == 'w')
Expand Down
0