[Zope-Checkins]
SVN: Zope/branches/jim-fix-zclasses/lib/python/ExtensionClass/
Fixed code that assumed that there weren't subclasses of the
Jim Fulton
jim at zope.com
Tue Feb 15 07:24:37 EST 2005
Log message for revision 29147:
Fixed code that assumed that there weren't subclasses of the
ExtensionClass meta class.
Changed:
U Zope/branches/jim-fix-zclasses/lib/python/ExtensionClass/ExtensionClass.h
U Zope/branches/jim-fix-zclasses/lib/python/ExtensionClass/_ExtensionClass.c
-=-
Modified: Zope/branches/jim-fix-zclasses/lib/python/ExtensionClass/ExtensionClass.h
===================================================================
--- Zope/branches/jim-fix-zclasses/lib/python/ExtensionClass/ExtensionClass.h 2005-02-15 06:07:28 UTC (rev 29146)
+++ Zope/branches/jim-fix-zclasses/lib/python/ExtensionClass/ExtensionClass.h 2005-02-15 12:24:37 UTC (rev 29147)
@@ -175,11 +175,11 @@
/* The following macro checks whether a type is an extension class: */
#define PyExtensionClass_Check(TYPE) \
- (((PyObject*)(TYPE))->ob_type == ECExtensionClassType)
+ PyObject_TypeCheck((PyObject*)(TYPE), ECExtensionClassType)
/* The following macro checks whether an instance is an extension instance: */
#define PyExtensionInstance_Check(INST) \
- (((PyObject*)(INST))->ob_type->ob_type == ECExtensionClassType)
+ PyObject_TypeCheck(((PyObject*)(INST))->ob_type, ECExtensionClassType)
#define CHECK_FOR_ERRORS(MESS)
@@ -213,7 +213,7 @@
/* Check whether an object has an __of__ method for returning itself
in the context of it's container. */
-#define has__of__(O) ((O)->ob_type->ob_type == ECExtensionClassType \
+#define has__of__(O) (PyObject_TypeCheck((O)->ob_type, ECExtensionClassType) \
&& (O)->ob_type->tp_descr_get != NULL)
/* The following macros are used to check whether an instance
Modified: Zope/branches/jim-fix-zclasses/lib/python/ExtensionClass/_ExtensionClass.c
===================================================================
--- Zope/branches/jim-fix-zclasses/lib/python/ExtensionClass/_ExtensionClass.c 2005-02-15 06:07:28 UTC (rev 29146)
+++ Zope/branches/jim-fix-zclasses/lib/python/ExtensionClass/_ExtensionClass.c 2005-02-15 12:24:37 UTC (rev 29147)
@@ -143,7 +143,7 @@
then call it. */
if (PyObject_TypeCheck(res->ob_type,
- &ExtensionClassType)
+ &ExtensionClassType)
&& res->ob_type->tp_descr_get != NULL)
res = res->ob_type->tp_descr_get(
res, obj,
More information about the Zope-Checkins
mailing list