You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yesterday, @JelleZijlstra enlightened me that sqlite3.Blob indexing operate with bytes objects of length 1. This is a deviation from how bytes, bytearray, and memoryview work:
>>> bytes(b"0")[0]
48
>>> bytearray(b"0")[0]
48
>>> memoryview(b"0")[0]
48
>>> b = bytearray(b"0")
>>> b[0] = 1
>>> b[0] = b"1"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'bytes' object cannot be interpreted as an integer
>>> m = memoryview(b)
>>> m[0] = 1
>>> m[0] = b"1"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: memoryview: invalid type for format 'B'
>>>
Suggesting to align sqlite3.Blob indexing behaviour so it expects ints and returns ints.
The text was updated successfully, but these errors were encountered:
Yesterday, @JelleZijlstra enlightened me that sqlite3.Blob indexing operate with
bytes
objects of length 1. This is a deviation from howbytes
,bytearray
, andmemoryview
work:Suggesting to align sqlite3.Blob indexing behaviour so it expects
int
s and returnsint
s.The text was updated successfully, but these errors were encountered: