mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-16 21:57:55 +00:00
Merge branch 'master' into python_multiple_inheritance_test
This commit is contained in:
commit
9ae6cbaea1
@ -2751,10 +2751,15 @@ get_type_override(const void *this_ptr, const type_info *this_type, const char *
|
|||||||
if ((std::string) str(f_code->co_name) == name && f_code->co_argcount > 0) {
|
if ((std::string) str(f_code->co_name) == name && f_code->co_argcount > 0) {
|
||||||
PyObject *locals = PyEval_GetLocals();
|
PyObject *locals = PyEval_GetLocals();
|
||||||
if (locals != nullptr) {
|
if (locals != nullptr) {
|
||||||
|
# if PY_VERSION_HEX >= 0x030b0000
|
||||||
|
PyObject *co_varnames = PyCode_GetVarnames(f_code);
|
||||||
|
# else
|
||||||
PyObject *co_varnames = PyObject_GetAttrString((PyObject *) f_code, "co_varnames");
|
PyObject *co_varnames = PyObject_GetAttrString((PyObject *) f_code, "co_varnames");
|
||||||
|
# endif
|
||||||
PyObject *self_arg = PyTuple_GET_ITEM(co_varnames, 0);
|
PyObject *self_arg = PyTuple_GET_ITEM(co_varnames, 0);
|
||||||
Py_DECREF(co_varnames);
|
Py_DECREF(co_varnames);
|
||||||
PyObject *self_caller = dict_getitem(locals, self_arg);
|
PyObject *self_caller = dict_getitem(locals, self_arg);
|
||||||
|
Py_DECREF(locals);
|
||||||
if (self_caller == self.ptr()) {
|
if (self_caller == self.ptr()) {
|
||||||
Py_DECREF(f_code);
|
Py_DECREF(f_code);
|
||||||
Py_DECREF(frame);
|
Py_DECREF(frame);
|
||||||
|
Loading…
Reference in New Issue
Block a user