diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-12-25 15:00:05 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-12-31 03:18:27 +0100 |
commit | f6fefbea64d699ca7eb041fb36ebc0ca4d2baa42 (patch) | |
tree | 8b0d76055641a7b3c9dda8101398cd378c77accb /psycopg/adapter_datetime.c | |
parent | 3214c23f51c8effa7e78f9a7f59735c5b3e10868 (diff) | |
download | psycopg2-f6fefbea64d699ca7eb041fb36ebc0ca4d2baa42.tar.gz |
Function psycopg_ensure_bytes converted in a "filter" stealing a ref.
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; } |