diff options
author | Federico Di Gregorio <fog@initd.org> | 2009-11-25 11:51:54 +0100 |
---|---|---|
committer | Federico Di Gregorio <fog@initd.org> | 2009-11-25 11:51:54 +0100 |
commit | bcc836c6610638f53a73c393b63bc49476786ec1 (patch) | |
tree | 95703cdbdd5a880a2f57e45749999d5ef4965550 /psycopg/microprotocols.c | |
parent | d40a5321f21d26cd800b8a37949f179f878b344c (diff) | |
download | psycopg2-bcc836c6610638f53a73c393b63bc49476786ec1.tar.gz |
Now adapt() errors include the type name
Diffstat (limited to 'psycopg/microprotocols.c')
-rw-r--r-- | psycopg/microprotocols.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/psycopg/microprotocols.c b/psycopg/microprotocols.c index f451e7e..2499358 100644 --- a/psycopg/microprotocols.c +++ b/psycopg/microprotocols.c @@ -74,6 +74,7 @@ PyObject * microprotocols_adapt(PyObject *obj, PyObject *proto, PyObject *alt) { PyObject *adapter, *key; + char buffer[256]; /* 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 @@ -114,7 +115,8 @@ microprotocols_adapt(PyObject *obj, PyObject *proto, PyObject *alt) } /* else set the right exception and return NULL */ - psyco_set_error(ProgrammingError, NULL, "can't adapt", NULL, NULL); + PyOS_snprintf(buffer, 255, "can't adapt type '%s'", obj->ob_type->tp_name); + psyco_set_error(ProgrammingError, NULL, buffer, NULL, NULL); return NULL; } |