diff options
Diffstat (limited to 'psycopg/adapter_datetime.c')
-rw-r--r-- | psycopg/adapter_datetime.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/psycopg/adapter_datetime.c b/psycopg/adapter_datetime.c index 56be0c9..ddcd089 100644 --- a/psycopg/adapter_datetime.c +++ b/psycopg/adapter_datetime.c @@ -59,7 +59,6 @@ _pydatetime_string_date_time(pydatetimeObject *self) { PyObject *rv = NULL; PyObject *iso = NULL; - PyObject *biso = NULL; PyObject *tz; /* Select the right PG type to cast into. */ @@ -79,22 +78,17 @@ _pydatetime_string_date_time(pydatetimeObject *self) break; } - if (!(iso = PyObject_CallMethod(self->wrapped, "isoformat", NULL))) { + if (!(iso = psycopg_ensure_bytes( + PyObject_CallMethod(self->wrapped, "isoformat", NULL)))) { goto error; } - if (!(biso = psycopg_ensure_bytes(iso))) { - goto error; - } - - rv = Bytes_FromFormat(fmt, Bytes_AsString(biso)); + rv = Bytes_FromFormat(fmt, Bytes_AsString(iso)); - Py_DECREF(biso); Py_DECREF(iso); return rv; error: - Py_XDECREF(biso); Py_XDECREF(iso); return rv; } |