[issue27177] re match.group should support __index__

Jeroen Demeyer report at bugs.python.org
Wed Jun 1 10:20:08 EDT 2016


New submission from Jeroen Demeyer:

```
>>> class zero(object):
...     def __index__(self):
...         return 0
... 
>>> z = zero()
>>> import re
>>> p = re.compile('(a)b')
>>> m = p.match('ab')
>>> m.group(0)
'ab'
>>> m.group(z)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: no such group
```

----------
components: Regular Expressions
files: re_match_index.patch
keywords: patch
messages: 266817
nosy: ezio.melotti, jdemeyer, mrabarnett
priority: normal
severity: normal
status: open
title: re match.group should support __index__
versions: Python 2.7
Added file: http://bugs.python.org/file43084/re_match_index.patch

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


More information about the Python-bugs-list mailing list