mirror of
https://github.com/python/cpython.git
synced 2025-07-24 19:54:21 +00:00
[3.9] bpo-45581: Raise MemoryError
in sqlite3.connect
if SQLite signals memory error (GH-29171) (GH-29324)
(cherry picked from commit e2e62b3808
)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
This commit is contained in:
parent
3ec1124de2
commit
ed807bf333
2 changed files with 6 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
|||
:meth:`sqlite3.connect` now correctly raises :exc:`MemoryError` if the
|
||||
underlying SQLite API signals memory error. Patch by Erlend E. Aasland.
|
|
@ -134,6 +134,10 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
|
|||
|
||||
Py_DECREF(database_obj);
|
||||
|
||||
if (self->db == NULL && rc == SQLITE_NOMEM) {
|
||||
PyErr_NoMemory();
|
||||
return -1;
|
||||
}
|
||||
if (rc != SQLITE_OK) {
|
||||
_pysqlite_seterror(self->db, NULL);
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue