From 66d5c6da0728640b2312c5e55a642a5ebb4e72e2 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Wed, 23 Jan 2019 09:28:26 +0000 Subject: [PATCH] Incref an object which will be held forever in a static var --- psycopg/typecast.c | 1 + 1 file changed, 1 insertion(+) diff --git a/psycopg/typecast.c b/psycopg/typecast.c index 005cce0e..ac2a0f9f 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);