Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(148803)

#13592: repr(regex) doesn't include actual regex

Can't Edit
Can't Publish+Mail
Start Review
Created:
7 years, 4 months ago by spamfaenger
Modified:
6 years ago
Reviewers:
ezio.melotti, thomas, storchaka
CC:
rhettinger, terry.reedy, AntoinePitrou, ezio.melotti, mrabarnett, alex, cjerdonek, devnull_psf.upfronthosting.co.za, eric.snow, spamfaenger_gmx.de, storchaka, hltbra, Drekin
Visibility:
Public.

Patch Set 1 #

Total comments: 3

Patch Set 2 #

Patch Set 3 #

Total comments: 9

Patch Set 4 #

Total comments: 9

Patch Set 5 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Lib/sre_constants.py View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
Lib/test/test_re.py View 1 2 3 4 1 chunk +62 lines, -0 lines 0 comments Download
Misc/NEWS View 1 2 3 4 1 chunk +3 lines, -0 lines 0 comments Download
Modules/_sre.c View 1 2 3 4 2 chunks +81 lines, -1 line 0 comments Download
Modules/sre_constants.h View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 4
ezio.melotti
http://bugs.python.org/review/13592/diff/5455/Lib/test/test_re.py File Lib/test/test_re.py (right): http://bugs.python.org/review/13592/diff/5455/Lib/test/test_re.py#newcode928 Lib/test/test_re.py:928: self.assertEquals('re.compile("random pattern", re.UNICODE)', repr(pattern)) 3 comments: 1) assertEquals is ...
7 years, 4 months ago #1
Thomas Wouters
http://bugs.python.org/review/13592/diff/5467/Lib/test/test_re.py File Lib/test/test_re.py (right): http://bugs.python.org/review/13592/diff/5467/Lib/test/test_re.py#newcode958 Lib/test/test_re.py:958: def test_repr_with_single_quotes_inside(self): For good measure, add a test with ...
6 years, 8 months ago #2
ezio.melotti
http://bugs.python.org/review/13592/diff/10071/Lib/test/test_re.py File Lib/test/test_re.py (right): http://bugs.python.org/review/13592/diff/10071/Lib/test/test_re.py#newcode1170 Lib/test/test_re.py:1170: "re.compile('random pattern', re.UNICODE)") I think re.UNICODE should be omitted, ...
6 years ago #3
storchaka_gmail.com
6 years ago #4
http://bugs.python.org/review/13592/diff/10071/Lib/test/test_re.py
File Lib/test/test_re.py (right):

http://bugs.python.org/review/13592/diff/10071/Lib/test/test_re.py#newcode1170
Lib/test/test_re.py:1170: "re.compile('random pattern', re.UNICODE)")
On 2013/11/23 17:59:13, ezio.melotti wrote:
> I think re.UNICODE should be omitted, since it's the default.

Done.

http://bugs.python.org/review/13592/diff/10071/Lib/test/test_re.py#newcode1184
Lib/test/test_re.py:1184: "re.compile('random pattern', "\
On 2013/11/23 17:59:13, ezio.melotti wrote:
> The \ is not necessary.

Done.

http://bugs.python.org/review/13592/diff/10071/Lib/test/test_re.py#newcode1189
Lib/test/test_re.py:1189: "re.compile(b'(?i)pattern', re.IGNORECASE)")
On 2013/11/23 17:59:13, ezio.melotti wrote:
> Careful with this:  IIRC on the regex module (and/or elsewhere), inline flags
> only affect what comes after them.
> For example 'foo(?i)bar' would match 'foobar' and 'fooBAR' but not 'FOObar'. 
If
> the re module sees and sets this as global then this test might be ok,
otherwise
> it might be better to leave it alone.

Yes, this is current behavior of re.

http://bugs.python.org/review/13592/diff/10071/Lib/test/test_re.py#newcode1212
Lib/test/test_re.py:1212: '''re.compile('both \\'single\\' and "double" quotes',
re.UNICODE)''')
On 2013/11/23 17:59:13, ezio.melotti wrote:
> What happens if the regex is particularly long?  Should the repr be truncated?

Done.
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+