summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2019-01-23 09:28:26 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2019-01-23 09:46:18 +0000
commit66d5c6da0728640b2312c5e55a642a5ebb4e72e2 (patch)
treec7d33643ab83aa7873837c58ce60fac012faef0f
parente9c476266c07821c2f5a3ceed1d6a8e7f6ae82c7 (diff)
downloadpsycopg2-66d5c6da0728640b2312c5e55a642a5ebb4e72e2.tar.gz
Incref an object which will be held forever in a static var
-rw-r--r--psycopg/typecast.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/psycopg/typecast.c b/psycopg/typecast.c
index 005cce0..ac2a0f9 100644
--- a/psycopg/typecast.c
+++ b/psycopg/typecast.c
@@ -278,6 +278,7 @@ typecast_init(PyObject *dict)
/* export binary object */
if (typecast_builtins[i].values == typecast_BINARY_types) {
+ Py_INCREF((PyObject *)t);
psyco_default_binary_cast = (PyObject *)t;
}
Py_DECREF((PyObject *)t);