-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
Open
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
The following code
import mmap
with open('test.dat', 'wb') as f:
f.write(b'A')
with open('test.dat', 'rb') as f:
mm = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
print(65 in memoryview(mm))
print(65 in bytearray(mm))
print(65 in mm)
mm.close()
prints
True
True
False
this even though mmap documentation claims that mmap works exactly like bytearray.
There is also discrepancy in the __iter__ implementation, but for that there is a workaround of using a memoryview object and that would be possibly backwards-incompatible change.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error