From ea923b63a48880d3d229241de42813a822e5db1e Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Tue, 20 Feb 2018 17:33:12 +0000 Subject: Allow strings subclasses in ensure_bytes Fix #679 --- psycopg/utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'psycopg/utils.c') diff --git a/psycopg/utils.c b/psycopg/utils.c index a197fe2..261810f 100644 --- a/psycopg/utils.c +++ b/psycopg/utils.c @@ -168,11 +168,11 @@ psycopg_ensure_bytes(PyObject *obj) PyObject *rv = NULL; if (!obj) { return NULL; } - if (PyUnicode_CheckExact(obj)) { + if (PyUnicode_Check(obj)) { rv = PyUnicode_AsUTF8String(obj); Py_DECREF(obj); } - else if (Bytes_CheckExact(obj)) { + else if (Bytes_Check(obj)) { rv = obj; } else { -- cgit v1.2.1