Skip to content

Commit 6bf1519

Browse files
author
Erlend E. Aasland
committed
Move sqlite3.InternalError to global state
1 parent 5addfbf commit 6bf1519

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

Modules/_sqlite/connection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ pysqlite_connection_init(pysqlite_Connection *self, PyObject *args,
196196
self->DataError = pysqlite_DataError;
197197
self->OperationalError = pysqlite_OperationalError;
198198
self->IntegrityError = pysqlite_IntegrityError;
199-
self->InternalError = pysqlite_InternalError;
199+
self->InternalError = state->InternalError;
200200
self->ProgrammingError = pysqlite_ProgrammingError;
201201
self->NotSupportedError = pysqlite_NotSupportedError;
202202

Modules/_sqlite/module.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ module _sqlite3
4343

4444
/* static objects at module-level */
4545

46-
PyObject *pysqlite_InternalError = NULL;
4746
PyObject *pysqlite_OperationalError = NULL;
4847
PyObject *pysqlite_ProgrammingError = NULL;
4948
PyObject *pysqlite_IntegrityError = NULL;
@@ -416,7 +415,7 @@ PyMODINIT_FUNC PyInit__sqlite3(void)
416415
ADD_EXCEPTION(module, "DatabaseError", state->DatabaseError, state->Error);
417416

418417
/* DatabaseError subclasses */
419-
ADD_EXCEPTION(module, "InternalError", pysqlite_InternalError,
418+
ADD_EXCEPTION(module, "InternalError", state->InternalError,
420419
state->DatabaseError);
421420
ADD_EXCEPTION(module, "OperationalError", pysqlite_OperationalError,
422421
state->DatabaseError);

Modules/_sqlite/module.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ typedef struct {
3333
PyObject *DatabaseError;
3434
PyObject *Error;
3535
PyObject *InterfaceError;
36+
PyObject *InternalError;
3637
PyObject *Warning;
3738
PyObject *lru_cache;
3839
PyTypeObject *ConnectionType;
@@ -50,7 +51,6 @@ pysqlite_get_state(PyObject *Py_UNUSED(module))
5051
return &pysqlite_global_state;
5152
}
5253

53-
extern PyObject* pysqlite_InternalError;
5454
extern PyObject* pysqlite_OperationalError;
5555
extern PyObject* pysqlite_ProgrammingError;
5656
extern PyObject* pysqlite_IntegrityError;

Modules/_sqlite/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ _pysqlite_seterror(sqlite3 *db)
5353
break;
5454
case SQLITE_INTERNAL:
5555
case SQLITE_NOTFOUND:
56-
PyErr_SetString(pysqlite_InternalError, sqlite3_errmsg(db));
56+
PyErr_SetString(state->InternalError, sqlite3_errmsg(db));
5757
break;
5858
case SQLITE_NOMEM:
5959
(void)PyErr_NoMemory();

0 commit comments

Comments
 (0)