homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: for string patterns regex.flags is never equal to 0
Type: Stage: resolved
Components: Documentation, Regular Expressions Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, eric.araujo, ezio.melotti, georg.brandl, mrabarnett, py.user, python-dev, r.david.murray
Priority: normal Keywords: easy, patch

Created on 2012年03月11日 00:46 by py.user, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
regexflags.patch georg.brandl, 2012年03月14日 06:58 review
Messages (10)
msg155362 - (view) Author: py.user (py.user) * Date: 2012年03月11日 00:46
http://docs.python.org/py3k/library/re.html#re.regex.flags
"or 0 if no flags were provided"
>>> import re
>>> p = re.compile(r'', 0)
>>> p.flags
32
>>>
msg155363 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012年03月11日 02:01
32 is re.U, which is always ored with the passed in flags, unless re.A is set in the passed in flags. The flag docs should certinaly be updated to reflect this.
msg155558 - (view) Author: py.user (py.user) * Date: 2012年03月13日 02:17
>>> import re
>>> p = re.compile(br'')
>>> p.flags
0
>>>
msg155559 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012年03月13日 02:20
Heh. Good point.
Documenting this is a clear way may be non-trivial.
msg155561 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2012年03月13日 02:55
Issue #13358 may be related
msg155562 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012年03月13日 03:03
It doesn't look like it. Is that the right issue number?
msg155564 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2012年03月13日 03:18
Oh, sorry I meant http://bugs.python.org/issue13385 
msg155727 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012年03月14日 06:58
There is even more wrongness here: if you give flags inline in the pattern, they also show up in .flags (since they are global, at least in the current implementation). Suggested patch attached.
msg156172 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年03月17日 16:29
New changeset b3b3a4a7d7b2 by Georg Brandl in branch '3.2':
Closes #14250: regex.flags has not only explicit flags but also implicit flags and those from the pattern
http://hg.python.org/cpython/rev/b3b3a4a7d7b2 
msg156173 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年03月17日 16:31
New changeset ac00531a63aa by Georg Brandl in branch '2.7':
Closes #14250: regex.flags has not only explicit flags but also those from the pattern
http://hg.python.org/cpython/rev/ac00531a63aa 
History
Date User Action Args
2022年04月11日 14:57:27adminsetgithub: 58458
2012年03月17日 16:31:32python-devsetmessages: + msg156173
2012年03月17日 16:29:44python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg156172

resolution: fixed
stage: patch review -> resolved
2012年03月17日 04:39:18eli.benderskysetnosy: - eli.bendersky
2012年03月16日 19:03:57terry.reedysetstage: needs patch -> patch review
2012年03月14日 06:58:19georg.brandlsetfiles: + regexflags.patch

nosy: + georg.brandl
messages: + msg155727

keywords: + patch
2012年03月13日 03:18:41eli.benderskysetmessages: + msg155564
2012年03月13日 03:03:20r.david.murraysetmessages: + msg155562
2012年03月13日 02:55:44eli.benderskysetnosy: + eli.bendersky
messages: + msg155561
2012年03月13日 02:20:36r.david.murraysetmessages: + msg155559
2012年03月13日 02:17:01py.usersetmessages: + msg155558
title: regex.flags is never equal to 0 -> for string patterns regex.flags is never equal to 0
2012年03月12日 00:32:26benjamin.petersonsetkeywords: + easy
2012年03月11日 10:21:09eric.araujosetnosy: + eric.araujo
2012年03月11日 02:01:12r.david.murraysetversions: + Python 3.3
nosy: + r.david.murray

messages: + msg155363

stage: needs patch
2012年03月11日 00:46:31py.usercreate

AltStyle によって変換されたページ (->オリジナル) /