mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-26 02:43:43 +03:00
Fixed build on windows
Will fail with error: initializer element is not constant
This commit is contained in:
parent
d36024dc1f
commit
408c76fdb6
|
@ -409,8 +409,8 @@ static struct {
|
||||||
PyObject **base;
|
PyObject **base;
|
||||||
const char *docstr;
|
const char *docstr;
|
||||||
} exctable[] = {
|
} exctable[] = {
|
||||||
{ "psycopg2.Error", &Error, &PyExc_StandardError, Error_doc },
|
{ "psycopg2.Error", &Error, NULL, Error_doc },
|
||||||
{ "psycopg2.Warning", &Warning, &PyExc_StandardError, Warning_doc },
|
{ "psycopg2.Warning", &Warning, NULL, Warning_doc },
|
||||||
{ "psycopg2.InterfaceError", &InterfaceError, &Error, InterfaceError_doc },
|
{ "psycopg2.InterfaceError", &InterfaceError, &Error, InterfaceError_doc },
|
||||||
{ "psycopg2.DatabaseError", &DatabaseError, &Error, DatabaseError_doc },
|
{ "psycopg2.DatabaseError", &DatabaseError, &Error, DatabaseError_doc },
|
||||||
{ "psycopg2.InternalError", &InternalError, &DatabaseError, InternalError_doc },
|
{ "psycopg2.InternalError", &InternalError, &DatabaseError, InternalError_doc },
|
||||||
|
@ -458,8 +458,12 @@ psyco_errors_init(void)
|
||||||
Py_CLEAR(str);
|
Py_CLEAR(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* can't put PyExc_StandardError in the static exctable:
|
||||||
|
* windows build will fail */
|
||||||
if (!(*exctable[i].exc = PyErr_NewException(
|
if (!(*exctable[i].exc = PyErr_NewException(
|
||||||
exctable[i].name, *exctable[i].base, dict))) {
|
exctable[i].name,
|
||||||
|
exctable[i].base ? *exctable[i].base : PyExc_StandardError,
|
||||||
|
dict))) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
Py_CLEAR(dict);
|
Py_CLEAR(dict);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user