File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -433,23 +433,23 @@ void function::add_to_namespace(
433433 if (attribute.ptr ()->ob_type == &function_type)
434434 {
435435 function* new_func = downcast<function>(attribute.ptr ());
436- PyObject* dict = 0 ;
436+ handle<> dict;
437437
438438#if PY_VERSION_HEX < 0x03000000
439439 // Old-style class gone in Python 3
440440 if (PyClass_Check (ns))
441- dict = (( PyClassObject*)ns)->cl_dict ;
441+ dict = handle<>( borrowed ((( PyClassObject*)ns)->cl_dict )) ;
442442 else
443443#endif
444444 if (PyType_Check (ns))
445- dict = (( PyTypeObject*)ns)->tp_dict ;
445+ dict = handle<>( borrowed ((( PyTypeObject*)ns)->tp_dict )) ;
446446 else
447- dict = PyObject_GetAttrString (ns, const_cast <char *>(" __dict__" ));
447+ dict = handle<>( PyObject_GetAttrString (ns, const_cast <char *>(" __dict__" ) ));
448448
449449 if (dict == 0 )
450450 throw_error_already_set ();
451451
452- handle<> existing (allow_null (::PyObject_GetItem (dict, name.ptr ())));
452+ handle<> existing (allow_null (::PyObject_GetItem (dict. get () , name.ptr ())));
453453
454454 if (existing)
455455 {
You can’t perform that action at this time.
0 commit comments