Check the presence of a mro.

The mere presence of the Py_TPFLAGS_HAVE_CLASS doesn't ensure it is
there.
This commit is contained in:
Daniele Varrazzo 2010-11-09 14:28:00 +00:00
parent f0773d5682
commit a39e98f9e5
2 changed files with 3 additions and 1 deletions

View File

@ -8,6 +8,8 @@
* Avoid pointless string manipulation in NamedTupleCursor (ticket #10)
* psycopg/microprotocols.c: Check the presence of a mro.
2010-11-08 Daniele Varrazzo <daniele.varrazzo@gmail.com>
* psycopg/microprotocols.c: use faster function to build tuples.

View File

@ -88,7 +88,7 @@ _get_superclass_adapter(PyObject *obj, PyObject *proto)
Py_ssize_t i, ii;
type = (PyTypeObject *)Py_TYPE(obj);
if (!(Py_TPFLAGS_HAVE_CLASS & type->tp_flags)) {
if (!((Py_TPFLAGS_HAVE_CLASS & type->tp_flags) && type->tp_mro)) {
/* has no mro */
return NULL;
}