Commit f2a95cb5 authored by Xavier Thompson's avatar Xavier Thompson

Allow subtypes of a cypclass wrapper to be converted to that cypclass base

parent 8b80fda7
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
template <typename U> template <typename U>
static inline U* __Pyx_PyObject_AsCyObject(PyObject * ob, PyTypeObject * type) { static inline U* __Pyx_PyObject_AsCyObject(PyObject * ob, PyTypeObject * type) {
// the PyObject is not of the expected type // the PyObject is not of the expected type
if (ob->ob_type != type) { if ( !PyType_IsSubtype(ob->ob_type, type) ) {
PyErr_Format(PyExc_TypeError, "Cannot convert PyObject %s to CyObject %s", ob->ob_type->tp_name, type->tp_name); PyErr_Format(PyExc_TypeError, "Cannot convert PyObject %s to CyObject %s", ob->ob_type->tp_name, type->tp_name);
return NULL; return NULL;
} }
......
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