[Raymond Hettinger] > ... > One situation did look suspect. _PySequence_IterSearch() remembers an > index/count across calls to PyIter_Next() -- it looks like the worst > that could happen is the index or count would be wrong, but no crashers. If the operation is PY_ITERSEARCH_INDEX, n is the 0-based count of the number of times the iterator got poked before the object was found. That's always correct, by definition (given that there's no guarantee the iterator can be rewound and restarted, or even that it would yield the same objects if it could be restarted, what else could "the index of the first occurrence" mean?). If the operation is PY_ITERSEARCH_COUNT, then n is the number of times poking the iterator returned the object in question. That's also correct by defintion of what PySequence_Count() means, although there's again no guarantee that the user passes a sensible iterable object (== one that would produce the same objects if crawled over a second time). So those are fine. Thanks for checking the others, and for checking in a test and the fix!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4