Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-92434: Silence a compiler warning in _sqlite/connection.c for 32bit version #93090

Merged
merged 8 commits into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:meth:`sqlite3.Connection.serialize` now raises :exc:`OverflowError` on 32-bit
platforms if the serialized database exceeds ``INT_MAX`` bytes.
5 changes: 4 additions & 1 deletion Modules/_sqlite/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -2091,7 +2091,10 @@ serialize_impl(pysqlite_Connection *self, const char *name)
name);
return NULL;
}
PyObject *res = PyBytes_FromStringAndSize(data, size);
#if PY_SSIZE_T_MAX < 9223372036854775807
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved
size = Py_MIN(size, INT_MAX);
#endif
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved
PyObject *res = PyBytes_FromStringAndSize(data, (Py_ssize_t)size);
if (!(flags & SQLITE_SERIALIZE_NOCOPY)) {
sqlite3_free((void *)data);
}
Expand Down