
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2016-06-01 14:20 byjdemeyer, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| re_match_index.patch | jdemeyer,2016-06-01 14:20 | Patch for Python 2.7 | ||
| issue27177.patch | xiang.zhang,2016-06-15 07:02 | review | ||
| Messages (9) | |||
|---|---|---|---|
| msg266817 -(view) | Author: Jeroen Demeyer (jdemeyer)*![]() | Date: 2016-06-01 14:20 | |
```>>> 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``` | |||
| msg266822 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2016-06-01 16:35 | |
This looks as new feature and can go only in 3.6. | |||
| msg266884 -(view) | Author: Jeroen Demeyer (jdemeyer)*![]() | Date: 2016-06-02 12:35 | |
I would still argue that it's a bug. The intention ofPEP 357 is that __index__ should be used whenever some object needs to be converted to a Py_ssize_t, which is exactly what you do here. | |||
| msg266885 -(view) | Author: Matthew Barnett (mrabarnett)*![]() | Date: 2016-06-02 14:00 | |
It would be a bug if it was supported but gave the wrong result.It has never been supported (the re module predatesPEP 357), so it's a new feature. | |||
| msg268606 -(view) | Author: Xiang Zhang (xiang.zhang)*![]() | Date: 2016-06-15 07:02 | |
Attach a patch to add this feature to Py3.6. | |||
| msg268775 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2016-06-18 07:37 | |
What is the use case? | |||
| msg268797 -(view) | Author: Jeroen Demeyer (jdemeyer)*![]() | Date: 2016-06-18 11:40 | |
My use case is SageMath:http://trac.sagemath.org/ticket/20750 | |||
| msg268800 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2016-06-18 13:06 | |
Interesting. This is very unusual but reasonable use case. | |||
| msg268804 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2016-06-18 13:48 | |
New changeset0303ab246152 by Serhiy Storchaka in branch 'default':Issue#27177: Match objects in the re module now support index-like objectshttps://hg.python.org/cpython/rev/0303ab246152 | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:31 | admin | set | github: 71364 |
| 2016-06-18 14:13:40 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: needs patch -> resolved |
| 2016-06-18 13:48:29 | python-dev | set | nosy: +python-dev messages: +msg268804 |
| 2016-06-18 13:06:55 | serhiy.storchaka | set | assignee:serhiy.storchaka messages: +msg268800 |
| 2016-06-18 11:40:28 | jdemeyer | set | messages: +msg268797 |
| 2016-06-18 07:37:37 | serhiy.storchaka | set | messages: +msg268775 |
| 2016-06-15 07:02:13 | xiang.zhang | set | files: +issue27177.patch nosy: +xiang.zhang messages: +msg268606 |
| 2016-06-02 14:00:55 | mrabarnett | set | messages: +msg266885 |
| 2016-06-02 12:35:59 | jdemeyer | set | messages: +msg266884 |
| 2016-06-01 16:35:13 | serhiy.storchaka | set | versions: + Python 3.6, - Python 2.7 nosy: +serhiy.storchaka messages: +msg266822 type: enhancement stage: needs patch |
| 2016-06-01 14:20:08 | jdemeyer | create | |