summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/cextension
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-03-13 20:38:30 -0700
committerMike Bayer <mike_mp@zzzcomputing.com>2012-03-13 20:38:30 -0700
commitbf57355feeb6f04d33ad778709f2fb39ad699aee (patch)
tree69e1c51d7a912fa5286e6efae33a6ff498aea73f /lib/sqlalchemy/cextension
parent4d2c1e2f17c702fd40af91532a36ec1b12db08fd (diff)
downloadsqlalchemy-bf57355feeb6f04d33ad778709f2fb39ad699aee.tar.gz
- [bug] Fixed bug in C extensions whereby
string format would not be applied to a Numeric value returned as integer; this affected primarily SQLite which does not maintain numeric scale settings. [ticket:2432]
Diffstat (limited to 'lib/sqlalchemy/cextension')
-rw-r--r--lib/sqlalchemy/cextension/processors.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/lib/sqlalchemy/cextension/processors.c b/lib/sqlalchemy/cextension/processors.c
index b539f6843..427db5d8e 100644
--- a/lib/sqlalchemy/cextension/processors.c
+++ b/lib/sqlalchemy/cextension/processors.c
@@ -342,23 +342,18 @@ DecimalResultProcessor_process(DecimalResultProcessor *self, PyObject *value)
if (value == Py_None)
Py_RETURN_NONE;
- if (PyFloat_CheckExact(value)) {
- /* Decimal does not accept float values directly */
- args = PyTuple_Pack(1, value);
- if (args == NULL)
- return NULL;
+ args = PyTuple_Pack(1, value);
+ if (args == NULL)
+ return NULL;
- str = PyString_Format(self->format, args);
- Py_DECREF(args);
- if (str == NULL)
- return NULL;
+ str = PyString_Format(self->format, args);
+ Py_DECREF(args);
+ if (str == NULL)
+ return NULL;
- result = PyObject_CallFunctionObjArgs(self->type, str, NULL);
- Py_DECREF(str);
- return result;
- } else {
- return PyObject_CallFunctionObjArgs(self->type, value, NULL);
- }
+ result = PyObject_CallFunctionObjArgs(self->type, str, NULL);
+ Py_DECREF(str);
+ return result;
}
static void