mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 00:46:33 +03:00
Don't abort if sqlstate_errors or psycoEncodings are already initialized
This commit is contained in:
parent
263ace6657
commit
46dcadbe38
1
NEWS
1
NEWS
|
@ -6,6 +6,7 @@ What's new in psycopg 2.8.7
|
||||||
|
|
||||||
- Accept empty params as `~psycopg2.connect()` (:ticket:`#1250`).
|
- Accept empty params as `~psycopg2.connect()` (:ticket:`#1250`).
|
||||||
- Fix attributes refcount in `Column` initialisation (:ticket:`#1252`).
|
- Fix attributes refcount in `Column` initialisation (:ticket:`#1252`).
|
||||||
|
- Allow re-initialisation of static variables in the C module (:ticket:`#1267`).
|
||||||
|
|
||||||
|
|
||||||
What's new in psycopg 2.8.6
|
What's new in psycopg 2.8.6
|
||||||
|
|
|
@ -608,6 +608,10 @@ encodings_init(PyObject *module)
|
||||||
int rv = -1;
|
int rv = -1;
|
||||||
|
|
||||||
Dprintf("psycopgmodule: initializing encodings table");
|
Dprintf("psycopgmodule: initializing encodings table");
|
||||||
|
if (psycoEncodings) {
|
||||||
|
Dprintf("encodings_init(): already called");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(psycoEncodings = PyDict_New())) { goto exit; }
|
if (!(psycoEncodings = PyDict_New())) { goto exit; }
|
||||||
Py_INCREF(psycoEncodings);
|
Py_INCREF(psycoEncodings);
|
||||||
|
@ -770,9 +774,8 @@ sqlstate_errors_init(PyObject *module)
|
||||||
Dprintf("psycopgmodule: initializing sqlstate exceptions");
|
Dprintf("psycopgmodule: initializing sqlstate exceptions");
|
||||||
|
|
||||||
if (sqlstate_errors) {
|
if (sqlstate_errors) {
|
||||||
PyErr_SetString(PyExc_SystemError,
|
Dprintf("sqlstate_errors_init(): already called");
|
||||||
"sqlstate_errors_init(): already called");
|
return 0;
|
||||||
goto exit;
|
|
||||||
}
|
}
|
||||||
if (!(errmodule = PyImport_ImportModule("psycopg2.errors"))) {
|
if (!(errmodule = PyImport_ImportModule("psycopg2.errors"))) {
|
||||||
/* don't inject the exceptions into the errors module */
|
/* don't inject the exceptions into the errors module */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user