summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Modules/_sqlite
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tools/python3/Modules/_sqlite')
-rw-r--r--contrib/tools/python3/Modules/_sqlite/blob.c39
-rw-r--r--contrib/tools/python3/Modules/_sqlite/clinic/blob.c.h19
-rw-r--r--contrib/tools/python3/Modules/_sqlite/clinic/connection.c.h41
-rw-r--r--contrib/tools/python3/Modules/_sqlite/connection.c96
-rw-r--r--contrib/tools/python3/Modules/_sqlite/ya.make4
5 files changed, 127 insertions, 72 deletions
diff --git a/contrib/tools/python3/Modules/_sqlite/blob.c b/contrib/tools/python3/Modules/_sqlite/blob.c
index 4db1ac474ef..c09c8582f89 100644
--- a/contrib/tools/python3/Modules/_sqlite/blob.c
+++ b/contrib/tools/python3/Modules/_sqlite/blob.c
@@ -167,14 +167,14 @@ _sqlite3.Blob.read as blob_read
Read data at the current offset position.
-If the end of the blob is reached, the data up to end of file will be returned.
-When length is not specified, or is negative, Blob.read() will read until the
-end of the blob.
+If the end of the blob is reached, the data up to end of file will
+be returned. When length is not specified, or is negative,
+Blob.read() will read until the end of the blob.
[clinic start generated code]*/
static PyObject *
blob_read_impl(pysqlite_Blob *self, int length)
-/*[clinic end generated code: output=1fc99b2541360dde input=f2e4aa4378837250]*/
+/*[clinic end generated code: output=1fc99b2541360dde input=6b745ad37720e556]*/
{
if (!check_blob(self)) {
return NULL;
@@ -234,13 +234,13 @@ _sqlite3.Blob.write as blob_write
Write data at the current offset.
-This function cannot change the blob length. Writing beyond the end of the
-blob will result in an exception being raised.
+This function cannot change the blob length. Writing beyond the end
+of the blob will result in an exception being raised.
[clinic start generated code]*/
static PyObject *
blob_write_impl(pysqlite_Blob *self, Py_buffer *data)
-/*[clinic end generated code: output=b34cf22601b570b2 input=a84712f24a028e6d]*/
+/*[clinic end generated code: output=b34cf22601b570b2 input=0d372cb0240a5d49]*/
{
if (!check_blob(self)) {
return NULL;
@@ -264,14 +264,15 @@ _sqlite3.Blob.seek as blob_seek
Set the current access position to offset.
-The origin argument defaults to os.SEEK_SET (absolute blob positioning).
-Other values for origin are os.SEEK_CUR (seek relative to the current position)
-and os.SEEK_END (seek relative to the blob's end).
+The origin argument defaults to os.SEEK_SET (absolute blob
+positioning). Other values for origin are os.SEEK_CUR (seek
+relative to the current position) and os.SEEK_END (seek relative to
+the blob's end).
[clinic start generated code]*/
static PyObject *
blob_seek_impl(pysqlite_Blob *self, int offset, int origin)
-/*[clinic end generated code: output=854c5a0e208547a5 input=5da9a07e55fe6bb6]*/
+/*[clinic end generated code: output=854c5a0e208547a5 input=84aea1b6b48607dd]*/
{
if (!check_blob(self)) {
return NULL;
@@ -516,21 +517,25 @@ ass_subscript_slice(pysqlite_Blob *self, PyObject *item, PyObject *value)
return -1;
}
- if (len == 0) {
- return 0;
- }
-
Py_buffer vbuf;
if (PyObject_GetBuffer(value, &vbuf, PyBUF_SIMPLE) < 0) {
return -1;
}
- int rc = -1;
if (vbuf.len != len) {
PyErr_SetString(PyExc_IndexError,
"Blob slice assignment is wrong size");
+ PyBuffer_Release(&vbuf);
+ return -1;
}
- else if (step == 1) {
+
+ if (len == 0) {
+ PyBuffer_Release(&vbuf);
+ return 0;
+ }
+
+ int rc = -1;
+ if (step == 1) {
rc = inner_write(self, vbuf.buf, len, start);
}
else {
diff --git a/contrib/tools/python3/Modules/_sqlite/clinic/blob.c.h b/contrib/tools/python3/Modules/_sqlite/clinic/blob.c.h
index b95ba948aaf..bfafcf05410 100644
--- a/contrib/tools/python3/Modules/_sqlite/clinic/blob.c.h
+++ b/contrib/tools/python3/Modules/_sqlite/clinic/blob.c.h
@@ -31,9 +31,9 @@ PyDoc_STRVAR(blob_read__doc__,
" length\n"
" Read length in bytes.\n"
"\n"
-"If the end of the blob is reached, the data up to end of file will be returned.\n"
-"When length is not specified, or is negative, Blob.read() will read until the\n"
-"end of the blob.");
+"If the end of the blob is reached, the data up to end of file will\n"
+"be returned. When length is not specified, or is negative,\n"
+"Blob.read() will read until the end of the blob.");
#define BLOB_READ_METHODDEF \
{"read", _PyCFunction_CAST(blob_read), METH_FASTCALL, blob_read__doc__},
@@ -70,8 +70,8 @@ PyDoc_STRVAR(blob_write__doc__,
"\n"
"Write data at the current offset.\n"
"\n"
-"This function cannot change the blob length. Writing beyond the end of the\n"
-"blob will result in an exception being raised.");
+"This function cannot change the blob length. Writing beyond the end\n"
+"of the blob will result in an exception being raised.");
#define BLOB_WRITE_METHODDEF \
{"write", (PyCFunction)blob_write, METH_O, blob_write__doc__},
@@ -105,9 +105,10 @@ PyDoc_STRVAR(blob_seek__doc__,
"\n"
"Set the current access position to offset.\n"
"\n"
-"The origin argument defaults to os.SEEK_SET (absolute blob positioning).\n"
-"Other values for origin are os.SEEK_CUR (seek relative to the current position)\n"
-"and os.SEEK_END (seek relative to the blob\'s end).");
+"The origin argument defaults to os.SEEK_SET (absolute blob\n"
+"positioning). Other values for origin are os.SEEK_CUR (seek\n"
+"relative to the current position) and os.SEEK_END (seek relative to\n"
+"the blob\'s end).");
#define BLOB_SEEK_METHODDEF \
{"seek", _PyCFunction_CAST(blob_seek), METH_FASTCALL, blob_seek__doc__},
@@ -211,4 +212,4 @@ blob_exit(pysqlite_Blob *self, PyObject *const *args, Py_ssize_t nargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=31abd55660e0c5af input=a9049054013a1b77]*/
+/*[clinic end generated code: output=45168bcaeea61140 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/_sqlite/clinic/connection.c.h b/contrib/tools/python3/Modules/_sqlite/clinic/connection.c.h
index c44b761aca6..4eede407f9a 100644
--- a/contrib/tools/python3/Modules/_sqlite/clinic/connection.c.h
+++ b/contrib/tools/python3/Modules/_sqlite/clinic/connection.c.h
@@ -799,13 +799,14 @@ PyDoc_STRVAR(pysqlite_connection_set_progress_handler__doc__,
"\n"
" progress_handler\n"
" A callable that takes no arguments.\n"
-" If the callable returns non-zero, the current query is terminated,\n"
-" and an exception is raised.\n"
+" If the callable returns non-zero, the current query is\n"
+" terminated, and an exception is raised.\n"
" n\n"
" The number of SQLite virtual machine instructions that are\n"
" executed between invocations of \'progress_handler\'.\n"
"\n"
-"If \'progress_handler\' is None or \'n\' is 0, the progress handler is disabled.\n"
+"If \'progress_handler\' is None or \'n\' is 0, the progress handler is\n"
+"disabled.\n"
"\n"
"Note: Passing keyword argument \'progress_handler\' to\n"
"_sqlite3.Connection.set_progress_handler() is deprecated. Parameter\n"
@@ -1453,10 +1454,10 @@ PyDoc_STRVAR(serialize__doc__,
" name\n"
" Which database to serialize.\n"
"\n"
-"For an ordinary on-disk database file, the serialization is just a copy of the\n"
-"disk file. For an in-memory database or a \"temp\" database, the serialization is\n"
-"the same sequence of bytes which would be written to disk if that database\n"
-"were backed up to disk.");
+"For an ordinary on-disk database file, the serialization is just\n"
+"a copy of the disk file. For an in-memory database or a \"temp\"\n"
+"database, the serialization is the same sequence of bytes which\n"
+"would be written to disk if that database were backed up to disk.");
#define SERIALIZE_METHODDEF \
{"serialize", _PyCFunction_CAST(serialize), METH_FASTCALL|METH_KEYWORDS, serialize__doc__},
@@ -1539,12 +1540,13 @@ PyDoc_STRVAR(deserialize__doc__,
" name\n"
" Which database to reopen with the deserialization.\n"
"\n"
-"The deserialize interface causes the database connection to disconnect from the\n"
-"target database, and then reopen it as an in-memory database based on the given\n"
-"serialized data.\n"
+"The deserialize interface causes the database connection to\n"
+"disconnect from the target database, and then reopen it as\n"
+"an in-memory database based on the given serialized data.\n"
"\n"
-"The deserialize interface will fail with SQLITE_BUSY if the database is\n"
-"currently in a read transaction or is involved in a backup operation.");
+"The deserialize interface will fail with SQLITE_BUSY if the database\n"
+"is currently in a read transaction or is involved in a backup\n"
+"operation.");
#define DESERIALIZE_METHODDEF \
{"deserialize", _PyCFunction_CAST(deserialize), METH_FASTCALL|METH_KEYWORDS, deserialize__doc__},
@@ -1662,7 +1664,8 @@ PyDoc_STRVAR(pysqlite_connection_exit__doc__,
"\n"
"Called when the connection is used as a context manager.\n"
"\n"
-"If there was any exception, a rollback takes place; otherwise we commit.");
+"If there was any exception, a rollback takes place; otherwise we\n"
+"commit.");
#define PYSQLITE_CONNECTION_EXIT_METHODDEF \
{"__exit__", _PyCFunction_CAST(pysqlite_connection_exit), METH_FASTCALL, pysqlite_connection_exit__doc__},
@@ -1700,12 +1703,12 @@ PyDoc_STRVAR(setlimit__doc__,
" category\n"
" The limit category to be set.\n"
" limit\n"
-" The new limit. If the new limit is a negative number, the limit is\n"
-" unchanged.\n"
+" The new limit. If the new limit is a negative number, the limit\n"
+" is unchanged.\n"
"\n"
-"Attempts to increase a limit above its hard upper bound are silently truncated\n"
-"to the hard upper bound. Regardless of whether or not the limit was changed,\n"
-"the prior value of the limit is returned.");
+"Attempts to increase a limit above its hard upper bound are silently\n"
+"truncated to the hard upper bound. Regardless of whether or not the\n"
+"limit was changed, the prior value of the limit is returned.");
#define SETLIMIT_METHODDEF \
{"setlimit", _PyCFunction_CAST(setlimit), METH_FASTCALL, setlimit__doc__},
@@ -1866,4 +1869,4 @@ exit:
#ifndef DESERIALIZE_METHODDEF
#define DESERIALIZE_METHODDEF
#endif /* !defined(DESERIALIZE_METHODDEF) */
-/*[clinic end generated code: output=fa34f4c5f8837a7c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=5e0bcef289eb64cc input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/_sqlite/connection.c b/contrib/tools/python3/Modules/_sqlite/connection.c
index 5f888ac19ec..bf5307ffac8 100644
--- a/contrib/tools/python3/Modules/_sqlite/connection.c
+++ b/contrib/tools/python3/Modules/_sqlite/connection.c
@@ -570,6 +570,47 @@ pysqlite_connection_cursor_impl(pysqlite_Connection *self, PyObject *factory)
return cursor;
}
+static PyObject *
+connection_get_row_factory(PyObject *op, void *closure)
+{
+ pysqlite_Connection *self = (pysqlite_Connection *)op;
+ return Py_NewRef(self->row_factory);
+}
+
+static int
+connection_set_row_factory(PyObject *op, PyObject *value, void *closure)
+{
+ pysqlite_Connection *self = (pysqlite_Connection *)op;
+ if (value == NULL) {
+ PyErr_SetString(PyExc_AttributeError,
+ "cannot delete row_factory attribute");
+ return -1;
+ }
+ Py_XSETREF(self->row_factory, Py_NewRef(value));
+ return 0;
+}
+
+static PyObject *
+connection_get_text_factory(PyObject *op, void *closure)
+{
+ pysqlite_Connection *self = (pysqlite_Connection *)op;
+ return Py_NewRef(self->text_factory);
+}
+
+static int
+connection_set_text_factory(PyObject *op, PyObject *value, void *closure)
+{
+ pysqlite_Connection *self = (pysqlite_Connection *)op;
+ if (value == NULL) {
+ PyErr_SetString(PyExc_AttributeError,
+ "cannot delete text_factory attribute");
+ return -1;
+ }
+ Py_XSETREF(self->text_factory, Py_NewRef(value));
+ return 0;
+}
+
+
/*[clinic input]
_sqlite3.Connection.blobopen as blobopen
@@ -1590,8 +1631,8 @@ _sqlite3.Connection.set_progress_handler as pysqlite_connection_set_progress_han
cls: defining_class
progress_handler as callable: object
A callable that takes no arguments.
- If the callable returns non-zero, the current query is terminated,
- and an exception is raised.
+ If the callable returns non-zero, the current query is
+ terminated, and an exception is raised.
/ [from 3.15]
n: int
The number of SQLite virtual machine instructions that are
@@ -1599,14 +1640,15 @@ _sqlite3.Connection.set_progress_handler as pysqlite_connection_set_progress_han
Set progress handler callback.
-If 'progress_handler' is None or 'n' is 0, the progress handler is disabled.
+If 'progress_handler' is None or 'n' is 0, the progress handler is
+disabled.
[clinic start generated code]*/
static PyObject *
pysqlite_connection_set_progress_handler_impl(pysqlite_Connection *self,
PyTypeObject *cls,
PyObject *callable, int n)
-/*[clinic end generated code: output=0739957fd8034a50 input=b4d6e2ef8b4d32f9]*/
+/*[clinic end generated code: output=0739957fd8034a50 input=d46887797f0c0ecf]*/
{
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
@@ -2234,15 +2276,15 @@ _sqlite3.Connection.serialize as serialize
Serialize a database into a byte string.
-For an ordinary on-disk database file, the serialization is just a copy of the
-disk file. For an in-memory database or a "temp" database, the serialization is
-the same sequence of bytes which would be written to disk if that database
-were backed up to disk.
+For an ordinary on-disk database file, the serialization is just
+a copy of the disk file. For an in-memory database or a "temp"
+database, the serialization is the same sequence of bytes which
+would be written to disk if that database were backed up to disk.
[clinic start generated code]*/
static PyObject *
serialize_impl(pysqlite_Connection *self, const char *name)
-/*[clinic end generated code: output=97342b0e55239dd3 input=d2eb5194a65abe2b]*/
+/*[clinic end generated code: output=97342b0e55239dd3 input=7e48654e8e082fa8]*/
{
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
@@ -2287,18 +2329,19 @@ _sqlite3.Connection.deserialize as deserialize
Load a serialized database.
-The deserialize interface causes the database connection to disconnect from the
-target database, and then reopen it as an in-memory database based on the given
-serialized data.
+The deserialize interface causes the database connection to
+disconnect from the target database, and then reopen it as
+an in-memory database based on the given serialized data.
-The deserialize interface will fail with SQLITE_BUSY if the database is
-currently in a read transaction or is involved in a backup operation.
+The deserialize interface will fail with SQLITE_BUSY if the database
+is currently in a read transaction or is involved in a backup
+operation.
[clinic start generated code]*/
static PyObject *
deserialize_impl(pysqlite_Connection *self, Py_buffer *data,
const char *name)
-/*[clinic end generated code: output=e394c798b98bad89 input=1be4ca1faacf28f2]*/
+/*[clinic end generated code: output=e394c798b98bad89 input=5d20e028d98c0686]*/
{
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
@@ -2371,13 +2414,14 @@ _sqlite3.Connection.__exit__ as pysqlite_connection_exit
Called when the connection is used as a context manager.
-If there was any exception, a rollback takes place; otherwise we commit.
+If there was any exception, a rollback takes place; otherwise we
+commit.
[clinic start generated code]*/
static PyObject *
pysqlite_connection_exit_impl(pysqlite_Connection *self, PyObject *exc_type,
PyObject *exc_value, PyObject *exc_tb)
-/*[clinic end generated code: output=0705200e9321202a input=bd66f1532c9c54a7]*/
+/*[clinic end generated code: output=0705200e9321202a input=8fdb0392ee6f3466]*/
{
int commit = 0;
PyObject* result;
@@ -2417,20 +2461,20 @@ _sqlite3.Connection.setlimit as setlimit
category: int
The limit category to be set.
limit: int
- The new limit. If the new limit is a negative number, the limit is
- unchanged.
+ The new limit. If the new limit is a negative number, the limit
+ is unchanged.
/
Set connection run-time limits.
-Attempts to increase a limit above its hard upper bound are silently truncated
-to the hard upper bound. Regardless of whether or not the limit was changed,
-the prior value of the limit is returned.
+Attempts to increase a limit above its hard upper bound are silently
+truncated to the hard upper bound. Regardless of whether or not the
+limit was changed, the prior value of the limit is returned.
[clinic start generated code]*/
static PyObject *
setlimit_impl(pysqlite_Connection *self, int category, int limit)
-/*[clinic end generated code: output=0d208213f8d68ccd input=9bd469537e195635]*/
+/*[clinic end generated code: output=0d208213f8d68ccd input=5c2e430091206677]*/
{
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
@@ -2628,6 +2672,10 @@ static PyGetSetDef connection_getset[] = {
{"in_transaction", (getter)pysqlite_connection_get_in_transaction, (setter)0},
{"autocommit", (getter)get_autocommit, (setter)set_autocommit},
{"__text_signature__", get_sig, (setter)0},
+ {"row_factory", connection_get_row_factory,
+ connection_set_row_factory},
+ {"text_factory", connection_get_text_factory,
+ connection_set_text_factory},
{NULL}
};
@@ -2675,8 +2723,6 @@ static struct PyMemberDef connection_members[] =
{"InternalError", _Py_T_OBJECT, offsetof(pysqlite_Connection, InternalError), Py_READONLY},
{"ProgrammingError", _Py_T_OBJECT, offsetof(pysqlite_Connection, ProgrammingError), Py_READONLY},
{"NotSupportedError", _Py_T_OBJECT, offsetof(pysqlite_Connection, NotSupportedError), Py_READONLY},
- {"row_factory", _Py_T_OBJECT, offsetof(pysqlite_Connection, row_factory)},
- {"text_factory", _Py_T_OBJECT, offsetof(pysqlite_Connection, text_factory)},
{NULL}
};
diff --git a/contrib/tools/python3/Modules/_sqlite/ya.make b/contrib/tools/python3/Modules/_sqlite/ya.make
index 56ee483669e..594b73af8c5 100644
--- a/contrib/tools/python3/Modules/_sqlite/ya.make
+++ b/contrib/tools/python3/Modules/_sqlite/ya.make
@@ -2,9 +2,9 @@
PY3_LIBRARY()
-VERSION(3.13.13)
+VERSION(3.13.14)
-ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.13.13.tar.gz)
+ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.13.14.tar.gz)
LICENSE(Python-2.0)