diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | psycopg/cursor_type.c | 5 |
3 files changed, 17 insertions, 0 deletions
@@ -1,3 +1,9 @@ +2005-05-31 Federico Di Gregorio <fog@debian.org> + + * psycopg/cursor_type.c (_psyco_curs_execute): if a + UnicodeEncodeError is raised during the converion of a unicode + query we let it propagate insead of segfaulting. + 2005-5-27 Federico Di Gregorio, <fog@lana.initd.org> * tests/types_basic.py: fixed float and binary tests. @@ -1,3 +1,9 @@ +What's new in psycopg 2.0 beta 4 +-------------------------------- + +* No more segfaults when a UNICODE query can't be converted to the + backend encoding. + What's new in psycopg 2.0 beta 3 -------------------------------- diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index 4b3de5b..b2a05d7 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -245,6 +245,11 @@ _psyco_curs_execute(cursorObject *self, if (enc) { operation = PyUnicode_AsEncodedString( operation, PyString_AsString(enc), NULL); + + /* if there was an error during the encoding from unicode to the + target encoding we just let the exception propagate */ + if (operation == NULL) return 0; + /* we clone operation in uoperation to be sure to free it later */ uoperation = operation; } |