Commit 5f2ac005 authored by Jim Fulton's avatar Jim Fulton

Fixed code that assumed that there weren't subclasses of the

ExtensionClass meta class.
parent 56f1205e
...@@ -175,11 +175,11 @@ static struct ExtensionClassCAPIstruct { ...@@ -175,11 +175,11 @@ static struct ExtensionClassCAPIstruct {
/* The following macro checks whether a type is an extension class: */ /* The following macro checks whether a type is an extension class: */
#define PyExtensionClass_Check(TYPE) \ #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: */ /* The following macro checks whether an instance is an extension instance: */
#define PyExtensionInstance_Check(INST) \ #define PyExtensionInstance_Check(INST) \
(((PyObject*)(INST))->ob_type->ob_type == ECExtensionClassType) PyObject_TypeCheck(((PyObject*)(INST))->ob_type, ECExtensionClassType)
#define CHECK_FOR_ERRORS(MESS) #define CHECK_FOR_ERRORS(MESS)
...@@ -213,7 +213,7 @@ static PyExtensionClass NAME ## Type = { PyObject_HEAD_INIT(NULL) 0, # NAME, \ ...@@ -213,7 +213,7 @@ static PyExtensionClass NAME ## Type = { PyObject_HEAD_INIT(NULL) 0, # NAME, \
/* Check whether an object has an __of__ method for returning itself /* Check whether an object has an __of__ method for returning itself
in the context of it's container. */ 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) && (O)->ob_type->tp_descr_get != NULL)
/* The following macros are used to check whether an instance /* The following macros are used to check whether an instance
......
...@@ -143,7 +143,7 @@ Base_getattro(PyObject *obj, PyObject *name) ...@@ -143,7 +143,7 @@ Base_getattro(PyObject *obj, PyObject *name)
then call it. */ then call it. */
if (PyObject_TypeCheck(res->ob_type, if (PyObject_TypeCheck(res->ob_type,
&ExtensionClassType) &ExtensionClassType)
&& res->ob_type->tp_descr_get != NULL) && res->ob_type->tp_descr_get != NULL)
res = res->ob_type->tp_descr_get( res = res->ob_type->tp_descr_get(
res, obj, res, obj,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment