File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -677,6 +677,10 @@ def CheckBlobRepeateNotSupported(self):
677677 with self .assertRaises (SystemError ):
678678 self .blob * 5
679679
680+ def CheckBlobContainsNotSupported (self ):
681+ with self .assertRaises (SystemError ):
682+ b"aaaaa" in self .blob
683+
680684@unittest .skipUnless (threading , 'This test requires threading.' )
681685class ThreadTests (unittest .TestCase ):
682686 def setUp (self ):
Original file line number Diff line number Diff line change @@ -327,6 +327,15 @@ static PyObject* pysqlite_blob_repeat(pysqlite_Blob *self, PyObject *args)
327327 return NULL ;
328328}
329329
330+ static int pysqlite_blob_contains (pysqlite_Blob * self , PyObject * args )
331+ {
332+ if (pysqlite_check_blob (self )) {
333+ PyErr_SetString (PyExc_SystemError ,
334+ "Blob don't support cotains operation" );
335+ }
336+ return -1 ;
337+ }
338+
330339static PyObject * pysqlite_blob_item (pysqlite_Blob * self , Py_ssize_t i )
331340{
332341 if (!pysqlite_check_blob (self )) {
@@ -606,6 +615,7 @@ static PySequenceMethods blob_sequence_methods = {
606615 .sq_repeat = (ssizeargfunc )pysqlite_blob_repeat ,
607616 .sq_item = (ssizeargfunc )pysqlite_blob_item ,
608617 .sq_ass_item = (ssizeobjargproc )pysqlite_blob_ass_item ,
618+ .sq_contains = (objobjproc )pysqlite_blob_contains ,
609619};
610620
611621static PyMappingMethods blob_mapping_methods = {
You can’t perform that action at this time.
0 commit comments