Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74321 - trunk/libs/python/src/object
From: rwgk_at_[hidden]
Date: 2011-09-08 17:27:11


Author: rwgk
Date: 2011-09-08 17:27:10 EDT (Thu, 08 Sep 2011)
New Revision: 74321
URL: http://svn.boost.org/trac/boost/changeset/74321

Log:
libs/python/src/object/function.cpp: apply patch by Matthew Bradbury (trac #4259)
Text files modified:
   trunk/libs/python/src/object/function.cpp | 10 +++++-----
   1 files changed, 5 insertions(+), 5 deletions(-)

Modified: trunk/libs/python/src/object/function.cpp
==============================================================================
--- trunk/libs/python/src/object/function.cpp (original)
+++ trunk/libs/python/src/object/function.cpp 2011-09-08 17:27:10 EDT (Thu, 08 Sep 2011)
@@ -433,23 +433,23 @@
     if (attribute.ptr()->ob_type == &function_type)
     {
         function* new_func = downcast<function>(attribute.ptr());
- PyObject* dict = 0;
+ handle<> dict;
         
 #if PY_VERSION_HEX < 0x03000000
         // Old-style class gone in Python 3
         if (PyClass_Check(ns))
- dict = ((PyClassObject*)ns)->cl_dict;
+ dict = handle<>(borrowed(((PyClassObject*)ns)->cl_dict));
         else
 #endif
         if (PyType_Check(ns))
- dict = ((PyTypeObject*)ns)->tp_dict;
+ dict = handle<>(borrowed(((PyTypeObject*)ns)->tp_dict));
         else
- dict = PyObject_GetAttrString(ns, const_cast<char*>("__dict__"));
+ dict = handle<>(PyObject_GetAttrString(ns, const_cast<char*>("__dict__")));
 
         if (dict == 0)
             throw_error_already_set();
 
- handle<> existing(allow_null(::PyObject_GetItem(dict, name.ptr())));
+ handle<> existing(allow_null(::PyObject_GetItem(dict.get(), name.ptr())));
         
         if (existing)
         {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk