From f59d626fe337260321c6bce60ce2da4b8577d4c9 Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Mon, 3 May 2021 23:30:13 +0200 Subject: [PATCH] Don't re-initialize psycoEncodings if already initialized --- psycopg/psycopgmodule.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c index 2a4c9e6a..d448d010 100644 --- a/psycopg/psycopgmodule.c +++ b/psycopg/psycopgmodule.c @@ -608,6 +608,10 @@ encodings_init(PyObject *module) int rv = -1; Dprintf("psycopgmodule: initializing encodings table"); + if (psycoEncodings) { + Dprintf("encodings_init(): already called"); + return 0; + } if (!(psycoEncodings = PyDict_New())) { goto exit; } Py_INCREF(psycoEncodings);