From c7d1271ab443defb0516ba269382bbb052c74493 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sun, 27 May 2012 08:58:55 +0100 Subject: [PATCH] Fixed cursor name as unicode string on Python 3 --- psycopg/cursor_type.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index 30126e41..2a653cf7 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -1824,6 +1824,13 @@ cursor_init(PyObject *obj, PyObject *args, PyObject *kwargs) if (name == Py_None) { cname = NULL; } else { + Py_INCREF(name); /* for ensure_bytes */ + if (!(name = psycopg_ensure_bytes(name))) { + /* name has had a ref stolen */ + return -1; + } + Py_DECREF(name); + if (!(cname = Bytes_AsString(name))) { return -1; }