mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 17:34:08 +03:00
Fixed error in register_type()
This commit is contained in:
parent
4077711050
commit
a3ce636be0
|
@ -1,5 +1,8 @@
|
||||||
2009-03-02 Federico Di Gregorio <fog@initd.org>
|
2009-03-02 Federico Di Gregorio <fog@initd.org>
|
||||||
|
|
||||||
|
* psycopg/psycopgmodule.c: fixed unwanted exception when passing an
|
||||||
|
explicit None to register_type().
|
||||||
|
|
||||||
* psycopg/config.h: applied patch from Jason Erickson to build
|
* psycopg/config.h: applied patch from Jason Erickson to build
|
||||||
with MSVC. Solaris version of isinf() is now a macro.
|
with MSVC. Solaris version of isinf() is now a macro.
|
||||||
|
|
||||||
|
|
|
@ -210,9 +210,10 @@ psyco_connect(PyObject *self, PyObject *args, PyObject *keywds)
|
||||||
|
|
||||||
/** type registration **/
|
/** type registration **/
|
||||||
#define psyco_register_type_doc \
|
#define psyco_register_type_doc \
|
||||||
"register_type(obj) -> None -- register obj with psycopg type system\n\n" \
|
"register_type(obj, conn_or_curs) -> None -- register obj with psycopg type system\n\n" \
|
||||||
":Parameters:\n" \
|
":Parameters:\n" \
|
||||||
" * `obj`: A type adapter created by `new_type()`"
|
" * `obj`: A type adapter created by `new_type()`" \
|
||||||
|
" * `conn_or_curs`: A connection, cursor or None"
|
||||||
|
|
||||||
#define typecast_from_python_doc \
|
#define typecast_from_python_doc \
|
||||||
"new_type(oids, name, adapter) -> new type object\n\n" \
|
"new_type(oids, name, adapter) -> new type object\n\n" \
|
||||||
|
@ -243,7 +244,7 @@ psyco_register_type(PyObject *self, PyObject *args)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj != NULL) {
|
if (obj != NULL && obj != Py_None) {
|
||||||
if (PyObject_TypeCheck(obj, &cursorType)) {
|
if (PyObject_TypeCheck(obj, &cursorType)) {
|
||||||
_psyco_register_type_set(&(((cursorObject*)obj)->string_types), type);
|
_psyco_register_type_set(&(((cursorObject*)obj)->string_types), type);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user