Ticket #4259: 4259-fix-reference-leak.patch
File 4259-fix-reference-leak.patch, 1.3 KB (added by , 12 years ago) |
---|
-
libs/python/src/object/function.cpp
433 433 if (attribute.ptr()->ob_type == &function_type) 434 434 { 435 435 function* new_func = downcast<function>(attribute.ptr()); 436 PyObject* dict = 0;436 handle<> dict; 437 437 438 438 #if PY_VERSION_HEX < 0x03000000 439 439 // Old-style class gone in Python 3 440 440 if (PyClass_Check(ns)) 441 dict = ((PyClassObject*)ns)->cl_dict;441 dict = handle<>(borrowed(((PyClassObject*)ns)->cl_dict)); 442 442 else 443 443 #endif 444 444 if (PyType_Check(ns)) 445 dict = ((PyTypeObject*)ns)->tp_dict;445 dict = handle<>(borrowed(((PyTypeObject*)ns)->tp_dict)); 446 446 else 447 dict = PyObject_GetAttrString(ns, const_cast<char*>("__dict__"));447 dict = handle<>(PyObject_GetAttrString(ns, const_cast<char*>("__dict__"))); 448 448 449 449 if (dict == 0) 450 450 throw_error_already_set(); 451 451 452 handle<> existing(allow_null(::PyObject_GetItem(dict , name.ptr())));452 handle<> existing(allow_null(::PyObject_GetItem(dict.get(), name.ptr()))); 453 453 454 454 if (existing) 455 455 {