diff options
author | Erlend Egeberg Aasland <erlend.aasland@innova.no> | 2021-10-29 20:21:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-29 20:21:58 (GMT) |
commit | e2e62b3808691e15fa44b883270023e42dcad958 (patch) | |
tree | 93cbd5374ba0948ada5d92e4608e1d794a2ec174 /Modules/_sqlite | |
parent | b17cfd150f4dc2816975d304a71110a2d445eaf0 (diff) | |
download | cpython-e2e62b3808691e15fa44b883270023e42dcad958.zip cpython-e2e62b3808691e15fa44b883270023e42dcad958.tar.gz cpython-e2e62b3808691e15fa44b883270023e42dcad958.tar.bz2 |
bpo-45581: Raise `MemoryError` in `sqlite3.connect` if SQLite signals memory error (GH-29171)
Diffstat (limited to 'Modules/_sqlite')
-rw-r--r-- | Modules/_sqlite/connection.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index da2f12e..94c38ad 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -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; |