From 22575528bedcdbf3d9daede6d2808f16684dbc99 Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Mon, 3 May 2021 15:14:07 +0200 Subject: [PATCH] Don't abort if sqlstate_errors already initialized --- psycopg/psycopgmodule.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c index 36fd1f9c..2a4c9e6a 100644 --- a/psycopg/psycopgmodule.c +++ b/psycopg/psycopgmodule.c @@ -770,9 +770,8 @@ sqlstate_errors_init(PyObject *module) Dprintf("psycopgmodule: initializing sqlstate exceptions"); if (sqlstate_errors) { - PyErr_SetString(PyExc_SystemError, - "sqlstate_errors_init(): already called"); - goto exit; + Dprintf("sqlstate_errors_init(): already called"); + return 0; } if (!(errmodule = PyImport_ImportModule("psycopg2.errors"))) { /* don't inject the exceptions into the errors module */