summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Modules/_sqlite/blob.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tools/python3/Modules/_sqlite/blob.c')
-rw-r--r--contrib/tools/python3/Modules/_sqlite/blob.c39
1 files changed, 22 insertions, 17 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 {