#20750 closed defect (fixed)
Fix re group indexing with Sage Integers
Reported by: | jdemeyer | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-7.3 |
Component: | packages: standard | Keywords: | |
Cc: | jhpalmieri | Merged in: | |
Authors: | Jeroen Demeyer | Reviewers: | John Palmieri |
Report Upstream: | Fixed upstream, but not in a stable release. | Work issues: | |
Branch: | 5dbc699 (Commits, GitHub, GitLab) | Commit: | |
Dependencies: | Stopgaps: |
Description (last modified by )
This breaks:
sage: import re sage: p = re.compile('(a)b') sage: m = p.match('ab') sage: m.group(0) IndexError: no such group
The reason is that the re
module does not handle Sage Integers:
sage: m.group(int(0)) 'ab'
Upstream: http://bugs.python.org/issue27177
Change History (10)
comment:1 Changed 6 years ago by
- Description modified (diff)
- Report Upstream changed from Not yet reported upstream; Will do shortly. to Reported upstream. No feedback yet.
comment:2 Changed 6 years ago by
- Branch set to u/jdemeyer/fix_re_group_indexing_with_sage_integers
comment:3 Changed 6 years ago by
- Commit set to 5dbc699911095dd03f0141a7c1b7ba1c7056ceef
- Status changed from new to needs_review
comment:4 Changed 6 years ago by
- Reviewers set to John Palmieri
- Status changed from needs_review to positive_review
This looks good to me and appears to fix the problem. I have not run the modified Python test suite yet, but everything else looks okay. Thanks for working on this!
comment:5 Changed 6 years ago by
- Report Upstream changed from Reported upstream. No feedback yet. to Reported upstream. Developers deny it's a bug.
comment:6 Changed 6 years ago by
- Branch changed from u/jdemeyer/fix_re_group_indexing_with_sage_integers to 5dbc699911095dd03f0141a7c1b7ba1c7056ceef
- Resolution set to fixed
- Status changed from positive_review to closed
comment:7 Changed 6 years ago by
- Commit 5dbc699911095dd03f0141a7c1b7ba1c7056ceef deleted
- Report Upstream changed from Reported upstream. Developers deny it's a bug. to Fixed upstream, but not in a stable release.
comment:8 follow-up: ↓ 9 Changed 6 years ago by
Late reaction. This is so weird on the sage-on-gentoo front. With python 2.7.10 the doctest without problem and without the patch to python. Python 2.7.12 enters stable and now the doctest fails if I don't patch python. I am weirded out on that one.
comment:9 in reply to: ↑ 8 Changed 6 years ago by
Replying to fbissey:
With python 2.7.10 the doctest [passes?] without problem and without the patch to python.
Are you really sure about that? I find that very hard to believe. It certainly doesn't work in Sage without the Python patch.
comment:10 Changed 6 years ago by
I verified on a machine that I had with sage 7.4 but still on python 2.7.10 an hour ago. By now it has probably been upgraded but I have been wondering about those two doctests failing suddenly for the last week and a bit on my main machine before tracking it to here and discovering the date of the merge. I am not sure what is in python 2.7.10 from gentoo that makes those tests pass I must say. Especially when 2.7.12 then fails.
But it is more of a curiosity.
New commits:
Fix re group indexing with Sage Integers