Try to not use cl_dict

Bug #958117 reported by Thomas Herve
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zope.proxy
Won't Fix
Undecided
Unassigned

Bug Description

It'd be nice to not use this implementation detail, to hope to be able to compile under pypy one day. Here's a proposed patch:

=== modified file 'zope/proxy/_zope_proxy_proxy.c'
--- zope/proxy/_zope_proxy_proxy.c 2012-02-23 14:05:31 +0000
+++ zope/proxy/_zope_proxy_proxy.c 2012-03-17 19:46:22 +0000
@@ -174,13 +174,15 @@

         if (((PyTypeObject *)base) != &ProxyType) {
             if (PyClass_Check(base))
- dict = ((PyClassObject *)base)->cl_dict;
+ dict = GetAttrString(base, "__dict__");
             else {
                 assert(PyType_Check(base));
                 dict = ((PyTypeObject *)base)->tp_dict;
+ Py_INCREF(dict);
             }
             assert(dict && PyDict_Check(dict));
             res = PyDict_GetItem(dict, name);
+ Py_DECREF(dict);
             if (res != NULL)
                 return res;
         }

Thanks!

Revision history for this message
Tres Seaver (tseaver) wrote :
Changed in zope.proxy:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.