[issue28727] Implement comparison (x==y and x!=y) for _sre.SRE_Pattern

STINNER Victor report at bugs.python.org
Fri Nov 18 18:04:15 EST 2016


STINNER Victor added the comment:

New approach: patch 5 now compares indexgroup, groupindex and code instead of comparing pattern, to handle correctly two equal pattern strings compiled with the re.LOCALE flag and two different locales.

The patch also converts indexgroup list to a tuple to be able to hash it. (It also prevents modification, but this is just a side effect, and groupindex remains a mutable dictionary.)

_sre.compile() checks types which helps to identify a bug in unit tests.

----------
Added file: http://bugs.python.org/file45541/pattern_compare-5.patch

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


More information about the Python-bugs-list mailing list