| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
factory (GH-95146) (#95158)
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>.
(cherry picked from commit a3d4d15f53777662ce0957500e5a538ce7161f5e)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
|
|
|
|
|
| |
(cherry picked from commit fb6dccae348b954d9f625031b54711a9a33da525)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
|
|
|
|
|
|
|
| |
Also add adapters and converter recipes.
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com.
(cherry picked from commit bd3c1c187e0e4fde5aec6835d180e9eddde8ceb6)
|
|
|
|
|
|
|
| |
(GH-94042)
(cherry picked from commit 94eeac03dc8c643ff050e7d0d306637d9556f798)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
|
|
|
|
|
|
| |
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
(cherry picked from commit 6446592c89b0c581c00e170ae6278291e940755c)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The fix involves using pysqlite_check_remaining_sql(), not only to check
for multiple statements, but now also to strip leading comments and
whitespace from SQL statements, so we can improve DML query detection.
pysqlite_check_remaining_sql() is renamed lstrip_sql(), to more
accurately reflect its function, and hardened to handle more SQL comment
corner cases.
(cherry picked from commit 46740073ef32bf83964c39609c7a7a4772c51ce3)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
|
|
|
|
|
|
|
| |
systems (GH-93090)
(cherry picked from commit d8395eb38d3d05f74a7f348da81a280ad272b8c8)
Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
|
|
|
|
|
| |
(cherry picked from commit 875de61c296604f3a3a51e9d76355e0f1a24c6af)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
|
|
|
|
|
|
|
|
| |
sqlite3.connect() to bytes (GH-93046) (GH-93048)
Just pass it to the factory as is.
(cherry picked from commit 14c0d33016a967a98155f2e1615660e9328aef5d)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
|
|
|
|
| |
(cherry picked from commit d8537580921b2e02f477ff1a8dedcf82c24ef0c2)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
misuse (#91572)
* Map SQLITE_MISUSE to sqlite3.InterfaceError
SQLITE_MISUSE implies misuse of the SQLite C API, which, if it happens,
is _not_ a user error; it is an sqlite3 extension module error.
* Raise better errors when binding parameters fail.
Instead of always raising InterfaceError, guessing what went wrong,
raise accurate exceptions with more accurate error messages.
|
|
|
|
| |
Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
| |
|
| |
|
| |
|
|
|
|
| |
Replace "(PyCFunction)(void(*)(void))func" cast with
_PyCFunction_CAST(func).
|
|
|
|
|
| |
- Make sure SQLite resources are freed if database open fails
- Remove unneeded branches if init is aborted
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
- get index now returns an int
- set index now requires an int in range(0, 256)
Resolves #92019
|
|
|
|
|
| |
Argument Clinic now generates the same efficient code as before
adding the defining_class parameter.
|
|
|
|
| |
Authored-by: Aviv Palivoda <palaviv@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@innova.no>
|
| |
|
|
|
|
|
| |
Unless sqlite3_blob_open() returns SQLITE_MISUSE, the error code and
message are available on the connection object. This means we have to
handle SQLITE_MISUSE error messages explicitly.
|
| |
|
|
|
|
| |
I noticed this was missing while writing typeshed stubs. It's
useful to expose it for use in annotations and for exploration.
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
| |
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Improve exception compliance with PEP 249
* Raise InterfaceError instead of ProgrammingError for SQLITE_MISUSE.
If SQLITE_MISUSE is raised, it is a sqlite3 module bug. Users of the
sqlite3 module are not responsible for using the SQLite C API correctly.
* Don't overwrite BufferError with ValueError when conversion to BLOB fails.
* Raise ProgrammingError instead of Warning if user tries to execute() more
than one SQL statement.
* Raise ProgrammingError instead of ValueError if an SQL query contains null characters.
* Make sure `_pysqlite_set_result` raises an exception if it returns -1.
|
|
|
| |
For consistency, replace "a SQL" with "an SQL".
|
|
|
|
|
| |
This reverts commit d1777515f9f53b452a4231d68196a7c0e5deb879.
Automerge-Triggered-By: GH:JelleZijlstra
|
| |
|
|
|
|
| |
Replace two instances of "pysqlite" with "sqlite3" in sqlite3
docstrings. Also reword "is a no-op" to "does nothing" for clarity.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
* Make PyType_GetModuleByDef public (remove underscore)
Co-authored-by: Victor Stinner <vstinner@python.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
|
|
| |
Automerge-Triggered-By: GH:pablogsal
|
|
|
| |
In SQLite versions pre 3.7.11, pending statements would block a rollback. This is no longer the case, so remove the workaround.
|
| |
|
| |
|
| |
|
| |
|