diff options
author | Federico Di Gregorio <fog@initd.org> | 2008-03-17 08:13:16 +0000 |
---|---|---|
committer | Federico Di Gregorio <fog@initd.org> | 2008-03-17 08:13:16 +0000 |
commit | 8103f44a125fc1207a5db6211ce902b0c70f8541 (patch) | |
tree | e7aa37b04bd4e8ff90b831552072dda25a8877fa | |
parent | cceaa7331b82294952aa18beba63616187f2fd93 (diff) | |
download | psycopg2-8103f44a125fc1207a5db6211ce902b0c70f8541.tar.gz |
Fixed test segfault due to double decref.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | ZPsycopgDA/DA.py | 2 | ||||
-rw-r--r-- | psycopg/adapter_datetime.c | 19 | ||||
-rw-r--r-- | setup.py | 2 |
5 files changed, 18 insertions, 13 deletions
@@ -1,3 +1,8 @@ +2008-03-17 Federico Di Gregorio <fog@initd.org> + + * psycopg/adapter_datetime.c: fixed double decref when using + a PyObject as a parameter in a nested call (line 415). + 2008-03-17 James Henstridge <james@jamesh.id.au> * psycopg/typecast.c (typecast_parse_time): give the correct @@ -1,4 +1,4 @@ -What's new in psycopg 2.0.7 (unreleased) +What's new in psycopg 2.0.7 --------------------------- * Improved error handling: @@ -43,7 +43,6 @@ What's new in psycopg 2.0.7 (unreleased) to set the PSYCOPG_DEBUG environment variable to turn on debug spew. - What's new in psycopg 2.0.6 --------------------------- diff --git a/ZPsycopgDA/DA.py b/ZPsycopgDA/DA.py index 5afa429..a80f9fd 100644 --- a/ZPsycopgDA/DA.py +++ b/ZPsycopgDA/DA.py @@ -18,7 +18,7 @@ # See the LICENSE file for details. -ALLOWED_PSYCOPG_VERSIONS = ('2.0.6',) +ALLOWED_PSYCOPG_VERSIONS = ('2.0.7',) import sys import time diff --git a/psycopg/adapter_datetime.c b/psycopg/adapter_datetime.c index 98922d3..1a68a67 100644 --- a/psycopg/adapter_datetime.c +++ b/psycopg/adapter_datetime.c @@ -406,17 +406,18 @@ psyco_TimestampFromTicks(PyObject *self, PyObject *args) t = (time_t)round(ticks); ticks -= (double)t; if (localtime_r(&t, &tm)) { - args = Py_BuildValue("iiiiidO", - tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, - tm.tm_hour, tm.tm_min, - (double)tm.tm_sec + ticks, - pyPsycopgTzLOCAL); - if (args) { -/* Dprintf("psyco_TimestampFromTicks: args->refcnt = %d", args->ob_refcnt);*/ - res = psyco_Timestamp(self, args); - Py_DECREF(args); + PyObject *value = Py_BuildValue("iiiiidO", + tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, + tm.tm_hour, tm.tm_min, + (double)tm.tm_sec + ticks, + pyPsycopgTzLOCAL); + if (value) { + /* we don't decref the value here because the call to + psyco_Timestamp will do that by calling PyArg_ParseTuple */ + res = psyco_Timestamp(self, value); } } + return res; } @@ -54,7 +54,7 @@ from distutils.command.build_ext import build_ext from distutils.sysconfig import get_python_inc from distutils.ccompiler import get_default_compiler -PSYCOPG_VERSION = '2.0.6' +PSYCOPG_VERSION = '2.0.7' version_flags = [] PLATFORM_IS_WINDOWS = sys.platform.lower().startswith('win') |