bpo-45581: Raise MemoryError in sqlite3.connect if SQLite signals memory error (GH-29171)

This commit is contained in:
Erlend Egeberg Aasland 2021-10-29 22:21:58 +02:00 committed by GitHub
parent b17cfd150f
commit e2e62b3808
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -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;