mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-26 02:43:43 +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);
|
Py_DECREF(decimalType);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
PyErr_Clear();
|
||||||
res = PyObject_CallFunction((PyObject*)&PyFloat_Type, "s", buffer);
|
res = PyObject_CallFunction((PyObject*)&PyFloat_Type, "s", buffer);
|
||||||
}
|
}
|
||||||
PyMem_Free(buffer);
|
PyMem_Free(buffer);
|
||||||
|
|
|
@ -427,12 +427,10 @@ psyco_is_main_interp(void)
|
||||||
|
|
||||||
/* psyco_GetDecimalType
|
/* 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 function returns a cached version of the object, but only in the main
|
||||||
the float type.
|
interpreter because subinterpreters are confusing.
|
||||||
|
|
||||||
If decimals are not to be used, return NULL.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
|
@ -456,7 +454,6 @@ psyco_GetDecimalType(void)
|
||||||
Py_DECREF(decimal);
|
Py_DECREF(decimal);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PyErr_Clear();
|
|
||||||
decimalType = NULL;
|
decimalType = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user