summaryrefslogtreecommitdiff
path: root/psycopg/microprotocols.c
diff options
context:
space:
mode:
Diffstat (limited to 'psycopg/microprotocols.c')
-rw-r--r--psycopg/microprotocols.c5
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);