mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 08:56:34 +03:00
More straightforward semantics for psyco_GetDecimalType
Raise an exception when returning NULL, leave the caller cleaning it.
This commit is contained in:
parent
2ad2b27065
commit
594df09a63
|
@ -148,6 +148,7 @@ typecast_DECIMAL_cast(const char *s, Py_ssize_t len, PyObject *curs)
|
|||
Py_DECREF(decimalType);
|
||||
}
|
||||
else {
|
||||
PyErr_Clear();
|
||||
res = PyObject_CallFunction((PyObject*)&PyFloat_Type, "s", buffer);
|
||||
}
|
||||
PyMem_Free(buffer);
|
||||
|
|
|
@ -427,12 +427,10 @@ psyco_is_main_interp(void)
|
|||
|
||||
/* psyco_GetDecimalType
|
||||
|
||||
Return a new reference to the adapter for decimal type.
|
||||
Return a new reference to the decimal type.
|
||||
|
||||
If decimals should be used but the module import fails, fall back on
|
||||
the float type.
|
||||
|
||||
If decimals are not to be used, return NULL.
|
||||
The function returns a cached version of the object, but only in the main
|
||||
interpreter because subinterpreters are confusing.
|
||||
*/
|
||||
|
||||
PyObject *
|
||||
|
@ -456,7 +454,6 @@ psyco_GetDecimalType(void)
|
|||
Py_DECREF(decimal);
|
||||
}
|
||||
else {
|
||||
PyErr_Clear();
|
||||
decimalType = NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user