summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite
Commit message (Collapse)AuthorAgeFilesLines
* bpo-46541: Replace _Py_IDENTIFIER with _Py_ID in sqlite3 (GH-31351)Erlend Egeberg Aasland2022-02-165-39/+61
|
* bpo-46613: Add PyType_GetModuleByDef to the public API (GH-31081)Petr Viktorin2022-02-111-1/+1
| | | | | * Make PyType_GetModuleByDef public (remove underscore) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized ↵Eric Snow2022-02-084-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | global objects. (gh-30928) We're no longer using _Py_IDENTIFIER() (or _Py_static_string()) in any core CPython code. It is still used in a number of non-builtin stdlib modules. The replacement is: PyUnicodeObject (not pointer) fields under _PyRuntimeState, statically initialized as part of _PyRuntime. A new _Py_GET_GLOBAL_IDENTIFIER() macro facilitates lookup of the fields (along with _Py_GET_GLOBAL_STRING() for non-identifier strings). https://bugs.python.org/issue46541#msg411799 explains the rationale for this change. The core of the change is in: * (new) Include/internal/pycore_global_strings.h - the declarations for the global strings, along with the macros * Include/internal/pycore_runtime_init.h - added the static initializers for the global strings * Include/internal/pycore_global_objects.h - where the struct in pycore_global_strings.h is hooked into _PyRuntimeState * Tools/scripts/generate_global_objects.py - added generation of the global string declarations and static initializers I've also added a --check flag to generate_global_objects.py (along with make check-global-objects) to check for unused global strings. That check is added to the PR CI config. The remainder of this change updates the core code to use _Py_GET_GLOBAL_IDENTIFIER() instead of _Py_IDENTIFIER() and the related _Py*Id functions (likewise for _Py_GET_GLOBAL_STRING() instead of _Py_static_string()). This includes adding a few functions where there wasn't already an alternative to _Py*Id(), replacing the _Py_Identifier * parameter with PyObject *. The following are not changed (yet): * stop using _Py_IDENTIFIER() in the stdlib modules * (maybe) get rid of _Py_IDENTIFIER(), etc. entirely -- this may not be doable as at least one package on PyPI using this (private) API * (maybe) intern the strings during runtime init https://bugs.python.org/issue46541
* bpo-43853: Expand test suite for SQLite UDF's (GH-27642)Erlend Egeberg Aasland2022-01-262-3/+14
|
* bpo-46249: Move set lastrowid out of the sqlite3 query loop (GH-30489)Erlend Egeberg Aasland2022-01-221-11/+11
|
* bpo-44092: Remove unused member `reset` from `sqlite3.Cursor` (GH-30377)Erlend Egeberg Aasland2022-01-032-20/+0
| | | Automerge-Triggered-By: GH:pablogsal
* bpo-44092: Don't reset statements/cursors before rollback (GH-26026)Erlend Egeberg Aasland2022-01-031-24/+0
| | | In SQLite versions pre 3.7.11, pending statements would block a rollback. This is no longer the case, so remove the workaround.
* bpo-45828: Use unraisable exceptions within sqlite3 callbacks (FH-29591)Erlend Egeberg Aasland2021-11-291-1/+1
|
* bpo-45512: Use Argument Clinic to set sqlite3 isolation level (GH-29593)Erlend Egeberg Aasland2021-11-182-72/+67
|
* bpo-45512: Simplify manage isolation level (GH-29562)Dong-hee Na2021-11-173-41/+33
|
* bpo-45126: Harden `sqlite3` connection initialisation (GH-28227)Erlend Egeberg Aasland2021-11-162-62/+72
|
* bpo-45512: Raise exception if sqlite3.Connection.__init__ is called with bad ↵Erlend Egeberg Aasland2021-11-151-3/+3
| | | | | | | | | | | | | | | isolation level (#29561) * bpo-45512: Raise sqlite3.Connection.__init__ is called with bad isolation level * Also explicitly test allowed isolation levels * Use subTest for better error messages if something goes wrong * Update Lib/test/test_sqlite3/test_dbapi.py Co-authored-by: Dong-hee Na <donghee.na92@gmail.com> Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
* bpo-45512: Simplify isolation_level handling in `sqlite3` (GH-29053)Erlend Egeberg Aasland2021-11-153-63/+84
|
* bpo-45754: Use correct SQLite limit when checking statement length (GH-29489)Erlend Egeberg Aasland2021-11-102-4/+4
|
* bpo-45731: Handle --enable-loadable-sqlite-extensions in configure (GH-29434)Christian Heimes2021-11-062-6/+6
|
* bpo-45613: Set `sqlite3.threadsafety` dynamically (GH-29227)Erlend Egeberg Aasland2021-11-031-0/+30
| | | | | | | | | Use the compile-time selected default SQLite threaded mode to set the DB-API 2.0 attribute 'threadsafety' Mappings: - SQLITE_THREADSAFE=0 => threadsafety=0 - SQLITE_THREADSAFE=1 => threadsafety=3 - SQLITE_THREADSAFE=2 => threadsafety=1
* bpo-24139: Add support for SQLite extended result codes (GH-28076)Erlend Egeberg Aasland2021-11-022-3/+131
|
* bpo-42064: Adapt `sqlite3` to multi-phase init (PEP 489) (GH-29234)Erlend Egeberg Aasland2021-11-021-20/+99
|
* bpo-45243: Add support for setting/getting `sqlite3` connection limits ↵Erlend Egeberg Aasland2021-11-013-1/+146
| | | | (GH-28463)
* bpo-45634: Don't combine error checks when adding `sqlite3` int constants ↵Erlend Egeberg Aasland2021-10-311-41/+48
| | | | (GH-29251)
* bpo-45581: Raise `MemoryError` in `sqlite3.connect` if SQLite signals memory ↵Erlend Egeberg Aasland2021-10-291-0/+4
| | | | error (GH-29171)
* bpo-42064: Convert `sqlite3` global state to module state (GH-29073)Erlend Egeberg Aasland2021-10-278-55/+36
|
* bpo-42064: Add module backref to `sqlite3` callback context (GH-28242)Erlend Egeberg Aasland2021-10-193-125/+91
|
* bpo-44991: Normalise function and collation callback naming (GH-28209)Erlend Egeberg Aasland2021-10-121-7/+5
|
* bpo-45439: Move _PyObject_CallNoArgs() to pycore_call.h (GH-28895)Victor Stinner2021-10-121-2/+2
| | | | | | | * Move _PyObject_CallNoArgs() to pycore_call.h (internal C API). * _ssl, _sqlite and _testcapi extensions now call the public PyObject_CallNoArgs() function, rather than _PyObject_CallNoArgs(). * _lsprof extension is now built with Py_BUILD_CORE_MODULE macro defined to get access to internal _PyObject_CallNoArgs().
* bpo-45439: Rename _PyObject_CallNoArg() to _PyObject_CallNoArgs() (GH-28891)Victor Stinner2021-10-111-2/+2
| | | | | Fix typo in the private _PyObject_CallNoArg() function name: rename it to _PyObject_CallNoArgs() to be consistent with the public function PyObject_CallNoArgs().
* bpo-45041: Restore `sqlite3` executescript behaviour for `SELECT` queries ↵Erlend Egeberg Aasland2021-10-071-1/+1
| | | | | | | (GH-28509) * bpo-45041: Restore sqlite3 executescript behaviour for select queries * Add regression test
* bpo-44958: Revert GH-27844 (GH-28574)Erlend Egeberg Aasland2021-09-263-40/+39
| | | | This reverts commit 050d1035957379d70e8601e6f5636637716a264b, but keeps the tests.
* bpo-44958: Only reset `sqlite3` statements when needed (GH-27844)Erlend Egeberg Aasland2021-09-213-39/+40
|
* bpo-45041: Simplify `sqlite3.Cursor.executescript()` (GH-28020)Erlend Egeberg Aasland2021-09-191-42/+25
|
* bpo-45040: Simplify sqlite3 transaction control functions (GH-28019)Erlend Egeberg Aasland2021-09-192-63/+28
|
* bpo-45126: Fix ref. leak in `sqlite3.Connection.__init__` (GH-28231)Erlend Egeberg Aasland2021-09-122-13/+49
|
* bpo-43413: Fix handling keyword arguments in subclasses of some buitin ↵Serhiy Storchaka2021-09-122-4/+6
| | | | | | | | classes (GH-26456) * Constructors of subclasses of some buitin classes (e.g. tuple, list, frozenset) no longer accept arbitrary keyword arguments. * Subclass of set can now define a __new__() method with additional keyword parameters without overriding also __init__().
* bpo-42064: Pass module state to trace, progress, and authorizer callbacks ↵Erlend Egeberg Aasland2021-09-072-73/+111
| | | | | | | | (GH-27940) - add print-or-clear traceback helper - add helpers to clear and visit saved contexts - modify callbacks to use the new callback_context struct
* bpo-44991: Normalise `sqlite3` callback naming (GH-28088)Erlend Egeberg Aasland2021-09-072-52/+59
| | | | | | | | - all callbacks are now named xxx_callback - normalise callable naming in set_*() functions - normalise context argument naming in callbacks The sqlite code is being "touched" in bpo-42064 (and related issues); this style change makes it easier to work with and review.
* Remove unused macros from Modules/_sqlite/microprotocols.h (GH-28171)Erlend Egeberg Aasland2021-09-051-6/+0
|
* bpo-42064: Offset arguments for PyObject_Vectorcall in the _sqlite module ↵Petr Viktorin2021-08-312-10/+14
| | | | | | | (GH-27931) This allows e.g. methods to be called efficiently by providing space for a "self" argument; see PY_VECTORCALL_ARGUMENTS_OFFSET docs.
* bpo-44991: Make GIL handling more explicit in `sqlite3` callbacks (GH-27934)Erlend Egeberg Aasland2021-08-311-35/+27
| | | | | | | | - acquire the GIL at the very start[1] - release the GIL at the very end [1] The trace callback performs a sanity check before acquiring the GIL Automerge-Triggered-By: GH:encukou
* bpo-16379: expose SQLite error codes and error names in `sqlite3` (GH-27786)Erlend Egeberg Aasland2021-08-303-29/+153
|
* bpo-27334: Fix reference leak introduced by GH-26202 (GH-27942)Erlend Egeberg Aasland2021-08-251-0/+1
|
* bpo-27334: roll back transaction if sqlite3 context manager fails to commit ↵Erlend Egeberg Aasland2021-08-251-7/+21
| | | | | | (GH-26202) Co-authored-by: Luca Citi Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
* bpo-44976: Lazy creation of sqlite3 result rows (GH-27884)Erlend Egeberg Aasland2021-08-252-58/+29
|
* bpo-42064: Pass module state to `sqlite3` UDF callbacks (GH-27456)Erlend Egeberg Aasland2021-08-242-31/+64
| | | | - Establish common callback context struct - Convert UDF callbacks to fetch module state from callback context
* Remove unused UNKNOWN macros from cursor.h and prepare_protocol.h (GH-27885)Erlend Egeberg Aasland2021-08-222-2/+0
|
* bpo-44965: Early exit for non-DML statements in sqlite3.Cursor.executemany() ↵Erlend Egeberg Aasland2021-08-211-8/+7
| | | | (GH-27865)
* bpo-44079: Strip superfluous statement cache from sqlite3.Connection (GH-25998)Erlend Egeberg Aasland2021-08-184-116/+18
|
* bpo-44859: Improve error handling in sqlite3 and and raise more accurate ↵Serhiy Storchaka2021-08-084-33/+52
| | | | | | | | | | | | | | | | | | | | exceptions. (GH-27654) * MemoryError is now raised instead of sqlite3.Warning when memory is not enough for encoding a statement to UTF-8 in Connection.__call__() and Cursor.execute(). * UnicodEncodeError is now raised instead of sqlite3.Warning when the statement contains surrogate characters in Connection.__call__() and Cursor.execute(). * TypeError is now raised instead of ValueError for non-string script argument in Cursor.executescript(). * ValueError is now raised for script containing the null character instead of truncating it in Cursor.executescript(). * Correctly handle exceptions raised when getting boolean value of the result of the progress handler. * Add many tests covering different corner cases. Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
* bpo-44839: Raise more specific errors in sqlite3 (GH-27613)Serhiy Storchaka2021-08-061-36/+31
| | | | | | MemoryError raised in user-defined functions will now preserve its type. OverflowError will now be converted to DataError. Previously both were converted to OperationalError.
* bpo-44822: Don't truncate `str`s with embedded NULL chars returned by ↵Erlend Egeberg Aasland2021-08-051-3/+10
| | | | `sqlite3` UDF callbacks (GH-27588)
* bpo-31746: Fix broken call in GH-27431 (GH-27464)Erlend Egeberg Aasland2021-07-291-1/+1
|