[issue26358] mmap.mmap.__iter__ is broken (yields bytes instead of ints)

Xiang Zhang report at bugs.python.org
Fri Apr 29 04:04:31 EDT 2016


Xiang Zhang added the comment:

Although Serhiy thinks we need a separate class for this but I still want to upload my patch first. Maybe some of it can be helpful later, or garbage.

I add a mmap_contains to fix the in operator's behaviour (I don't find the separate issue). I use the simplest search method which is O(m*n). Previously I thought it is not acceptable but I find out that mmap_gfind goes this way too.

By the way, only operations related to mmap_item are affected, which I can see is iteration and in (search does not need to iterate since there is find method), indexing is not affected. So maybe this does not break the backward compatibility that hard.

Hope no disturb.

----------
keywords: +patch
Added file: http://bugs.python.org/file42647/mmap_bytearray_like.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26358>
_______________________________________


More information about the Python-bugs-list mailing list