[issue28765] _sre.compile(): be more strict on types of indexgroup and groupindex

STINNER Victor report at bugs.python.org
Mon Nov 21 10:57:38 EST 2016


New submission from STINNER Victor:

Attached patch makes _sre.compile() more strict on types: groupindex must be a dictionary and indexgroup must be a tuple.

Currently, indexgroup is passed as a list. I chose to convert it to a tuple to use less memory and to prevent unwanted changes. For unwanted changed, I'm not sure because groupindex remains a mutable dictionary. Do you think that it's worth it to require a tuple? Another option is to accept a list but to convert it to a list, but this change is more specific to the current implementation.

----------
files: sre_types.patch
keywords: patch
messages: 281373
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: _sre.compile(): be more strict on types of indexgroup and groupindex
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file45590/sre_types.patch

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


More information about the Python-bugs-list mailing list