diff options
| author | Federico Di Gregorio <fog@initd.org> | 2009-03-09 21:45:49 +0100 |
|---|---|---|
| committer | Federico Di Gregorio <fog@initd.org> | 2009-03-09 21:45:49 +0100 |
| commit | 0b0639dae59de40dbe640ae9727f0f06bfc50f69 (patch) | |
| tree | 20cd4a66672d566b47402bc936f6f8b12b70bad8 /psycopg/microprotocols.c | |
| parent | a574321fcde5be521f9727e82feeef7e5afc4f24 (diff) | |
| download | psycopg2-0b0639dae59de40dbe640ae9727f0f06bfc50f69.tar.gz | |
Fixed error when adapt()ing None
Diffstat (limited to 'psycopg/microprotocols.c')
| -rw-r--r-- | psycopg/microprotocols.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/psycopg/microprotocols.c b/psycopg/microprotocols.c index 4232fd4..f451e7e 100644 --- a/psycopg/microprotocols.c +++ b/psycopg/microprotocols.c @@ -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); |
