mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-45581: Raise MemoryError
in sqlite3.connect
if SQLite signals memory error (GH-29171)
This commit is contained in:
parent
b17cfd150f
commit
e2e62b3808
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.
|
|
@ -165,6 +165,10 @@ pysqlite_connection_init_impl(pysqlite_Connection *self,
|
|||
(uri ? SQLITE_OPEN_URI : 0), NULL);
|
||||
Py_END_ALLOW_THREADS
|
||||
|
||||
if (self->db == NULL && rc == SQLITE_NOMEM) {
|
||||
PyErr_NoMemory();
|
||||
return -1;
|
||||
}
|
||||
if (rc != SQLITE_OK) {
|
||||
_pysqlite_seterror(state, self->db);
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue