From 5f7cbe86f2d8b74f28a3ead17f8a3cf27f44c34b Mon Sep 17 00:00:00 2001 From: vimiix Date: Mon, 26 Jun 2023 11:35:55 +0800 Subject: [PATCH] feat:support parse boolean from characters 0 and 1 --- psycopg/typecast_basic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/psycopg/typecast_basic.c b/psycopg/typecast_basic.c index f73f60bc..33c18ff8 100644 --- a/psycopg/typecast_basic.c +++ b/psycopg/typecast_basic.c @@ -97,11 +97,13 @@ typecast_BOOLEAN_cast(const char *s, Py_ssize_t len, PyObject *curs) if (s == NULL) { Py_RETURN_NONE; } switch (s[0]) { + case '1': case 't': case 'T': res = Py_True; break; + case '0': case 'f': case 'F': res = Py_False;