fix: handle NULL correctly (#5145)

This commit is contained in:
Henry Schreiner 2024-05-27 15:03:51 -04:00 committed by GitHub
parent 86a64290dc
commit ce08e37042
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2780,7 +2780,7 @@ get_type_override(const void *this_ptr, const type_info *this_type, const char *
PyObject *locals = PyEval_GetFrameLocals(); PyObject *locals = PyEval_GetFrameLocals();
# else # else
PyObject *locals = PyEval_GetLocals(); PyObject *locals = PyEval_GetLocals();
Py_INCREF(locals); Py_XINCREF(locals);
# endif # endif
if (locals != nullptr) { if (locals != nullptr) {
# if PY_VERSION_HEX >= 0x030b0000 # if PY_VERSION_HEX >= 0x030b0000