mirror of
https://github.com/python/cpython.git
synced 2025-09-15 21:26:04 +00:00
bpo-43321: Fix SystemError in getargs.c (GH-24656)
This commit is contained in:
parent
145bf269df
commit
c71d24f558
2 changed files with 4 additions and 2 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
Fix ``SystemError`` raised when ``PyArg_Parse*()`` is used with ``#`` but
|
||||||
|
without ``PY_SSIZE_T_CLEAN`` defined.
|
|
@ -655,14 +655,14 @@ static const char *
|
||||||
convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
||||||
char *msgbuf, size_t bufsize, freelist_t *freelist)
|
char *msgbuf, size_t bufsize, freelist_t *freelist)
|
||||||
{
|
{
|
||||||
|
#define RETURN_ERR_OCCURRED return msgbuf
|
||||||
/* For # codes */
|
/* For # codes */
|
||||||
#define REQUIRE_PY_SSIZE_T_CLEAN \
|
#define REQUIRE_PY_SSIZE_T_CLEAN \
|
||||||
if (!(flags & FLAG_SIZE_T)) { \
|
if (!(flags & FLAG_SIZE_T)) { \
|
||||||
PyErr_SetString(PyExc_SystemError, \
|
PyErr_SetString(PyExc_SystemError, \
|
||||||
"PY_SSIZE_T_CLEAN macro must be defined for '#' formats"); \
|
"PY_SSIZE_T_CLEAN macro must be defined for '#' formats"); \
|
||||||
return NULL; \
|
RETURN_ERR_OCCURRED; \
|
||||||
}
|
}
|
||||||
#define RETURN_ERR_OCCURRED return msgbuf
|
|
||||||
|
|
||||||
const char *format = *p_format;
|
const char *format = *p_format;
|
||||||
char c = *format++;
|
char c = *format++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue