summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Di Gregorio <fog@initd.org>2008-03-17 08:13:16 +0000
committerFederico Di Gregorio <fog@initd.org>2008-03-17 08:13:16 +0000
commit8103f44a125fc1207a5db6211ce902b0c70f8541 (patch)
treee7aa37b04bd4e8ff90b831552072dda25a8877fa
parentcceaa7331b82294952aa18beba63616187f2fd93 (diff)
downloadpsycopg2-8103f44a125fc1207a5db6211ce902b0c70f8541.tar.gz
Fixed test segfault due to double decref.
-rw-r--r--ChangeLog5
-rw-r--r--NEWS3
-rw-r--r--ZPsycopgDA/DA.py2
-rw-r--r--psycopg/adapter_datetime.c19
-rw-r--r--setup.py2
5 files changed, 18 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 60018ff..421e9e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/NEWS b/NEWS
index c07f16c..61cf125 100644
--- a/NEWS
+++ b/NEWS
@@ -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;
}
diff --git a/setup.py b/setup.py
index 9dfc79b..09181d4 100644
--- a/setup.py
+++ b/setup.py
@@ -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')