mirror of
https://github.com/python/cpython.git
synced 2026-06-28 03:41:13 +00:00
gh-151773: Fix NULL dereference in PyContextVar_Set (#151836)
This commit is contained in:
parent
5858e42c53
commit
d35b1719a5
2 changed files with 5 additions and 0 deletions
|
|
@ -362,6 +362,9 @@ PyContextVar_Set(PyObject *ovar, PyObject *val)
|
|||
Py_XINCREF(old_val);
|
||||
PyContextToken *tok = token_new(ctx, var, old_val);
|
||||
Py_XDECREF(old_val);
|
||||
if (tok == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (contextvar_set(var, val)) {
|
||||
Py_DECREF(tok);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue