Fixed error when adapt()ing None

This commit is contained in:
Federico Di Gregorio 2009-03-09 21:45:49 +01:00
parent a574321fcd
commit 0b0639dae5
2 changed files with 11 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2009-03-08 Federico Di Gregorio <fog@initd.org>
* microprotocols.c: None is always adapted to NULL to avoid
errors when calling adapt on nested types without first checking
for None.
2009-03-02 Federico Di Gregorio <fog@initd.org>
* Applied modified patch from Karsten Hilbert to provide a

View File

@ -78,6 +78,11 @@ microprotocols_adapt(PyObject *obj, PyObject *proto, PyObject *alt)
/* we don't check for exact type conformance as specified in PEP 246
because the ISQLQuote type is abstract and there is no way to get a
quotable object to be its instance */
/* None is always adapted to NULL */
if (obj == Py_None)
return PyString_FromString("NULL");
Dprintf("microprotocols_adapt: trying to adapt %s", obj->ob_type->tp_name);