mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-07-07 13:13:07 +03:00
Fixed error when adapt()ing None
This commit is contained in:
parent
a574321fcd
commit
0b0639dae5
|
@ -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>
|
2009-03-02 Federico Di Gregorio <fog@initd.org>
|
||||||
|
|
||||||
* Applied modified patch from Karsten Hilbert to provide a
|
* Applied modified patch from Karsten Hilbert to provide a
|
||||||
|
|
|
@ -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
|
/* 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
|
because the ISQLQuote type is abstract and there is no way to get a
|
||||||
quotable object to be its instance */
|
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);
|
Dprintf("microprotocols_adapt: trying to adapt %s", obj->ob_type->tp_name);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user