summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/clinic
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-113993: Make interned strings mortal (GH-120520, GH-121364, ↵Petr Viktorin2024-09-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GH-121903, GH-122303) (#123065) This backports several PRs for gh-113993, making interned strings mortal so they can be garbage-collected when no longer needed. * Allow interned strings to be mortal, and fix related issues (GH-120520) * Add an InternalDocs file describing how interning should work and how to use it. * Add internal functions to *explicitly* request what kind of interning is done: - `_PyUnicode_InternMortal` - `_PyUnicode_InternImmortal` - `_PyUnicode_InternStatic` * Switch uses of `PyUnicode_InternInPlace` to those. * Disallow using `_Py_SetImmortal` on strings directly. You should use `_PyUnicode_InternImmortal` instead: - Strings should be interned before immortalization, otherwise you're possibly interning a immortalizing copy. - `_Py_SetImmortal` doesn't handle the `SSTATE_INTERNED_MORTAL` to `SSTATE_INTERNED_IMMORTAL` update, and those flags can't be changed in backports, as they are now part of public API and version-specific ABI. * Add private `_only_immortal` argument for `sys.getunicodeinternedsize`, used in refleak test machinery. Make sure the statically allocated string singletons are unique. This means these sets are now disjoint: - `_Py_ID` - `_Py_STR` (including the empty string) - one-character latin-1 singletons Now, when you intern a singleton, that exact singleton will be interned. * Add a `_Py_LATIN1_CHR` macro, use it instead of `_Py_ID`/`_Py_STR` for one-character latin-1 singletons everywhere (including Clinic). * Intern `_Py_STR` singletons at startup. * Beef up the tests. Cover internal details (marked with `@cpython_only`). * Add lots of assertions * Don't immortalize in PyUnicode_InternInPlace; keep immortalizing in other API (GH-121364) * Switch PyUnicode_InternInPlace to _PyUnicode_InternMortal, clarify docs * Document immortality in some functions that take `const char *` This is PyUnicode_InternFromString; PyDict_SetItemString, PyObject_SetAttrString; PyObject_DelAttrString; PyUnicode_InternFromString; and the PyModule_Add convenience functions. Always point out a non-immortalizing alternative. * Don't immortalize user-provided attr names in _ctypes * Immortalize names in code objects to avoid crash (GH-121903) * Intern latin-1 one-byte strings at startup (GH-122303) There are some 3.12-specific changes, mainly to allow statically allocated strings in deepfreeze. (In 3.13, deepfreeze switched to the general `_Py_ID`/`_Py_STR`.) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* gh-100370: fix OverflowError in sqlite3.Connection.blobopen for 32-bit ↵Erlend E. Aasland2023-05-071-5/+4
| | | | builds (#103902)
* gh-103489: Add get/set config methods to sqlite3.Connection (#103506)Erlend E. Aasland2023-04-261-1/+80
|
* gh-103015: Add entrypoint keyword param to sqlite3.Connection.load_extension ↵Erlend E. Aasland2023-04-261-9/+64
| | | | (#103073)
* gh-101409: Improve generated clinic code for self type checks (#101411)Erlend E. Aasland2023-01-312-6/+7
|
* bpo-15999: Accept arbitrary values for boolean parameters. (#15609)Serhiy Storchaka2022-12-031-7/+7
| | | builtins and extension module functions and methods that expect boolean values for parameters now accept any Python object rather than just a bool or int type. This is more consistent with how native Python code itself behaves.
* gh-83638: Add sqlite3.Connection.autocommit for PEP 249 compliant behaviour ↵Erlend E. Aasland2022-11-121-10/+24
| | | | | | | | | | (#93823) Introduce the autocommit attribute to Connection and the autocommit parameter to connect() for PEP 249-compliant transaction handling. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Géry Ogam <gery.ogam@gmail.com>
* gh-90928: Improve static initialization of keywords tuple in AC (#95907)Erlend E. Aasland2022-08-133-278/+104
|
* gh-90928: Statically Initialize the Keywords Tuple in Clinic-Generated Code ↵Eric Snow2022-08-115-20/+545
| | | | | | | | | | | | | | | | (gh-95860) We only statically initialize for core code and builtin modules. Extension modules still create the tuple at runtime. We'll solve that part of interpreter isolation separately. This change includes generated code. The non-generated changes are in: * Tools/clinic/clinic.py * Python/getargs.c * Include/cpython/modsupport.h * Makefile.pre.in (re-generate global strings after running clinic) * very minor tweaks to Modules/_codecsmodule.c and Python/Python-tokenize.c All other changes are generated code (clinic, global strings).
* gh-95132: Correctly relay *args and **kwds from sqlite3.connect to factory ↵Erlend Egeberg Aasland2022-07-231-111/+1
| | | | | | | | | | | | (#95146) This PR partially reverts gh-24421 (PR) and fixes the remaining concerns given in gh-93044 (issue): - keyword arguments are passed as positional arguments to factory() - if an argument is not passed to sqlite3.connect(), its default value is passed to factory() Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-90016: Reword sqlite3 adapter/converter docs (#93095)Erlend Egeberg Aasland2022-06-251-5/+5
| | | | | | Also add adapters and converter recipes. Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com
* gh-93925: Improve clarity of sqlite3 commit/rollback, and close docs (#93926)Erlend Egeberg Aasland2022-06-191-4/+10
| | | Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
* gh-93044: No longer convert the database argument of sqlite3.connect() to ↵Serhiy Storchaka2022-05-211-4/+2
| | | | | bytes (GH-93046) Just pass it to the factory as is.
* gh-91922: Fix sqlite connection on nonstardard locales and paths (GH-92926)Serhiy Storchaka2022-05-201-11/+6
|
* gh-92547: Remove deprecated sqlite3 features (#92548)Erlend Egeberg Aasland2022-05-161-41/+1
| | | | | | | | | | The following sqlite3 features were deprecated in 3.10, scheduled for removal in 3.12: - sqlite3.OptimizedUnicode (gh-23163) - sqlite3.enable_shared_cache (gh-24008) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Signed-off-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-91320: Argument Clinic uses _PyCFunction_CAST() (#32210)Victor Stinner2022-05-034-33/+33
| | | | Replace "(PyCFunction)(void(*)(void))func" cast with _PyCFunction_CAST(func).
* gh-91583: AC: Fix regression for functions with defining_class (GH-91739)Serhiy Storchaka2022-04-301-22/+113
| | | | | Argument Clinic now generates the same efficient code as before adding the defining_class parameter.
* gh-69093: Add context manager support to sqlite3.Blob (GH-91562)Erlend Egeberg Aasland2022-04-161-1/+52
|
* gh-69093: Support basic incremental I/O to blobs in `sqlite3` (GH-30680)Erlend Egeberg Aasland2022-04-152-1/+270
| | | | | | | Authored-by: Aviv Palivoda <palaviv@gmail.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@innova.no> Co-authored-by: palaviv <palaviv@gmail.com> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-79097: Add support for aggregate window functions in sqlite3 (GH-20903)Erlend Egeberg Aasland2022-04-121-1/+52
|
* bpo-41930: Add support for SQLite serialise/deserialise API (GH-26728)Erlend Egeberg Aasland2022-04-051-1/+159
| | | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* sqlite3: normalise pre-acronym determiners (GH-31772)Erlend Egeberg Aasland2022-03-111-3/+3
| | | For consistency, replace "a SQL" with "an SQL".
* Docstring: replace pysqlite with sqlite3 (GH-31758)Erlend Egeberg Aasland2022-03-091-3/+3
| | | | Replace two instances of "pysqlite" with "sqlite3" in sqlite3 docstrings. Also reword "is a no-op" to "does nothing" for clarity.
* bpo-46878: Purge 'non-standard' from sqlite3 docstrings (GH-31612)Erlend Egeberg Aasland2022-03-083-27/+26
|
* bpo-45512: Use Argument Clinic to set sqlite3 isolation level (GH-29593)Erlend Egeberg Aasland2021-11-181-17/+2
|
* bpo-45126: Harden `sqlite3` connection initialisation (GH-28227)Erlend Egeberg Aasland2021-11-161-6/+6
|
* bpo-45512: Simplify isolation_level handling in `sqlite3` (GH-29053)Erlend Egeberg Aasland2021-11-151-4/+21
|
* bpo-45731: Handle --enable-loadable-sqlite-extensions in configure (GH-29434)Christian Heimes2021-11-061-5/+5
|
* bpo-45243: Add support for setting/getting `sqlite3` connection limits ↵Erlend Egeberg Aasland2021-11-011-1/+78
| | | | (GH-28463)
* bpo-42064: Convert `sqlite3` global state to module state (GH-29073)Erlend Egeberg Aasland2021-10-271-16/+5
|
* bpo-42064: Add module backref to `sqlite3` callback context (GH-28242)Erlend Egeberg Aasland2021-10-191-108/+46
|
* bpo-45126: Fix ref. leak in `sqlite3.Connection.__init__` (GH-28231)Erlend Egeberg Aasland2021-09-121-5/+8
|
* 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-44991: Normalise `sqlite3` callback naming (GH-28088)Erlend Egeberg Aasland2021-09-071-14/+13
| | | | | | | | - 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.
* bpo-44859: Improve error handling in sqlite3 and and raise more accurate ↵Serhiy Storchaka2021-08-081-1/+30
| | | | | | | | | | | | | | | | | | | | 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-42064: Optimise `sqlite3` state access, part 1 (GH-27273)Erlend Egeberg Aasland2021-07-291-5/+16
| | | | | | | | | | Prepare for module state: - Add "get state by defining class" and "get state by module def" stubs - Add AC defining class when needed - Add state pointer to connection context - Pass state as argument to utility functions Automerge-Triggered-By: GH:encukou
* bpo-44688: Remove ASCII limitation from `sqlite3` collation names (GH-27395)Erlend Egeberg Aasland2021-07-291-5/+11
|
* Fix docstring typo in ↵Erlend Egeberg Aasland2021-07-142-4/+4
| | | | | | | | sqlite3.Connection.executescript/sqlite3.Cursor.executescript (GH-27147) Both `executescript` methods contain the same docstring typo: _"Executes a multiple SQL statements at once."_ => _"Executes multiple SQL statements at once."_ Automerge-Triggered-By: GH:pablogsal
* bpo-40956: Convert sqlite3.connect and sqlite3.Connection.__init__ to AC ↵Erlend Egeberg Aasland2021-06-202-2/+215
| | | | (GH-24421)
* bpo-42064: Move sqlite3 types to global state (GH-26537)Erlend Egeberg Aasland2021-06-154-13/+13
| | | | | | | | | * Move connection type to global state * Move cursor type to global state * Move prepare protocol type to global state * Move row type to global state * Move statement type to global state * ADD_TYPE takes a pointer * pysqlite_get_state is now static inline
* bpo-40956: Fix segfault when Connection.backup is called without target ↵Erlend Egeberg Aasland2021-02-101-19/+10
| | | | (GH-24503)
* bpo-40956: Fix sqlite3.Cursor.fetchmany() default value (GH-24214)Erlend Egeberg Aasland2021-01-131-3/+6
|
* bpo-40956: Convert _sqlite3.Cursor to Argument Clinic (GH-24007)Erlend Egeberg Aasland2021-01-051-0/+259
|
* bpo-40956: Convert _sqlite3.Row to Argument Clinic (GH-23964)Erlend Egeberg Aasland2020-12-291-0/+56
|
* bpo-40956: Convert _sqlite3.Connection to Argument Clinic, part 2 (GH-23838)Erlend Egeberg Aasland2020-12-271-1/+209
|
* bpo-40956: Fix sqlite3 AC code (GH-23837)Dong-hee Na2020-12-181-3/+27
|
* bpo-40956: Convert _sqlite3.Connection to Argument Clinic (GH-23341)Erlend Egeberg Aasland2020-12-181-0/+490
|
* bpo-40956: Convert _sqlite3 module level functions to Argument Clinic (GH-22484)Erlend Egeberg Aasland2020-10-311-0/+222