[Checkins] SVN: zope.proxy/branches/regebro-python3/src/zope/proxy/_zope_proxy_proxy.c Some simplifications and cleanups.
Lennart Regebro
regebro at gmail.com
Sat Nov 20 13:31:54 EST 2010
Log message for revision 118511:
Some simplifications and cleanups.
Changed:
U zope.proxy/branches/regebro-python3/src/zope/proxy/_zope_proxy_proxy.c
-=-
Modified: zope.proxy/branches/regebro-python3/src/zope/proxy/_zope_proxy_proxy.c
===================================================================
--- zope.proxy/branches/regebro-python3/src/zope/proxy/_zope_proxy_proxy.c 2010-11-20 16:15:33 UTC (rev 118510)
+++ zope.proxy/branches/regebro-python3/src/zope/proxy/_zope_proxy_proxy.c 2010-11-20 18:31:54 UTC (rev 118511)
@@ -176,14 +176,13 @@
#if PY_MAJOR_VERSION < 3
if (PyClass_Check(base))
dict = ((PyClassObject *)base)->cl_dict;
- else {
+ else
+#endif
+ {
assert(PyType_Check(base));
dict = ((PyTypeObject *)base)->tp_dict;
}
-#else
- assert(PyType_Check(base));
- dict = ((PyTypeObject *)base)->tp_dict;
-#endif
+
assert(dict && PyDict_Check(dict));
res = PyDict_GetItem(dict, name);
if (res != NULL)
@@ -247,11 +246,11 @@
descriptor = WrapperType_Lookup(self->ob_type, name);
if (descriptor != NULL) {
- /* Support for old style classes */
-#if PY_MAJOR_VERSION < 3
- if (PyType_HasFeature(descriptor->ob_type, Py_TPFLAGS_HAVE_CLASS)
- && descriptor->ob_type->tp_descr_get != NULL) {
-
+ if (descriptor->ob_type->tp_descr_get != NULL
+#if PY_MAJOR_VERSION < 3 // Always true in Python 3
+ && PyType_HasFeature(descriptor->ob_type, Py_TPFLAGS_HAVE_CLASS)
+#endif
+ ){
if (descriptor->ob_type->tp_descr_set == NULL)
{
res = PyObject_GetAttr(wrapped, name);
@@ -269,7 +268,6 @@
(PyObject *)self->ob_type);
}
else
-#endif
{
Py_INCREF(descriptor);
res = descriptor;
More information about the checkins
mailing list