gh-151773: Fix NULL dereference in PyContextVar_Set (#151836)

This commit is contained in:
dev 2026-06-23 19:45:15 +05:30 committed by GitHub
parent 5858e42c53
commit d35b1719a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View file

@ -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);