[issue22437] re module: number of named groups is limited to 100 max

2014-09-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you Antoine for your review. To avoid discrepancy between re and regex (and other engines), I have committed only a part of dynamic patch, without adding support of backreferences with index over 99. It is unlikely to achieve this limit in hand written

[issue22437] re module: number of named groups is limited to 100 max

2014-09-29 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0b85ea4bd1af by Serhiy Storchaka in branch 'default': Issue #22437: Number of capturing groups in regular expression is no longer https://hg.python.org/cpython/rev/0b85ea4bd1af -- nosy: +python-dev ___ Py

[issue22437] re module: number of named groups is limited to 100 max

2014-09-26 Thread Yury Selivanov
Yury Selivanov added the comment: I'm fine with either one, Serhiy. The static one looks good to me. -- ___ Python tracker ___ ___ Pyt

[issue22437] re module: number of named groups is limited to 100 max

2014-09-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch which removes static limit. It is much more complicated than the first patch and I prefer first apply the first patch. Aren't 1000 groups enough for everyone? -- Added file: http://bugs.python.org/file36682/re_maxgroups_dynamic.patch

[issue22437] re module: number of named groups is limited to 100 max

2014-09-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is definitely not a bug fix. May be Matthew will commit it to the regex module and then you could use regex instead of re. -- ___ Python tracker ___

[issue22437] re module: number of named groups is limited to 100 max

2014-09-18 Thread Yury Selivanov
Yury Selivanov added the comment: Serhiy, This is awesome! Is is possible to split the patch in two, and commit the one that just increases the groups limit to 3.4 as well? Thank you -- ___ Python tracker _

[issue22437] re module: number of named groups is limited to 100 max

2014-09-18 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> serhiy.storchaka stage: -> patch review versions: +Python 3.5 ___ Python tracker ___ _

[issue22437] re module: number of named groups is limited to 100 max

2014-09-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There is two reasons for this limitation. First reason is mentioned by David. There is no syntax to backreference a group with number > 99 (but there is a syntax for conditional groups and for substitutions). Second reason is that current implementation of r

[issue22437] re module: number of named groups is limited to 100 max

2014-09-18 Thread Matthew Barnett
Matthew Barnett added the comment: In the regex module, I borrowed the \g<...> escape from .sub's replacement string to provide an alternative way to refer to a group in a pattern, and that let me remove the limit. -- ___ Python tracker

[issue22437] re module: number of named groups is limited to 100 max

2014-09-18 Thread R. David Murray
R. David Murray added the comment: It is 100 to avoid a syntactic ambiguity between numbered groups and octal numbers, if I remember correctly. I can't remember if that constraint still applies in python3, where the octal notation was made more strict in general. -- nosy: +r.david.mur

[issue22437] re module: number of named groups is limited to 100 max

2014-09-18 Thread Yury Selivanov
New submission from Yury Selivanov: While writing a lexer for javascript language, I managed to hit the limit of named groups in one regexp, it's 100. The check is in sre_compile.py:compile() function, and there is even an XXX comment on this. Unfortunately, I'm not an expert in this module,