mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
[3.12] gh-122334: Fix crash when importing ssl after re-initialization (GH-122481) (#122495)
Fix crash when importing ssl after re-initialization The current METH_FASTCALL|METH_KEYWORDS functions in a non-builtin module can cause segfaults after restarting the main interpreter, invoking _PyArg_UnpackKeywords() with an insufficiently cleared _PyArg_Parser struct. This patch fixes the invalidation of the static argument parsers.
This commit is contained in:
parent
372df19508
commit
6b8a9a1061
3 changed files with 28 additions and 0 deletions
|
|
@ -2071,6 +2071,18 @@ parser_clear(struct _PyArg_Parser *parser)
|
|||
if (parser->initialized == 1) {
|
||||
Py_CLEAR(parser->kwtuple);
|
||||
}
|
||||
|
||||
if (parser->format) {
|
||||
parser->fname = NULL;
|
||||
}
|
||||
else {
|
||||
assert(parser->fname != NULL);
|
||||
}
|
||||
parser->custom_msg = NULL;
|
||||
parser->pos = 0;
|
||||
parser->min = 0;
|
||||
parser->max = 0;
|
||||
parser->initialized = 0;
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue