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: Misleading debugging output for verbose regular expressions
Type: behavior Stage: resolved
Components: Regular Expressions Versions: Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: ezio.melotti, mrabarnett, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2016-03-03 08:19 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
re_verbose_debug.patch serhiy.storchaka, 2016-03-03 08:19 review
Messages (2)
msg261148 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-03-03 08:19
When the verbose mode is switched on by using the inline (?x) flag instead of re.VERBOSE argument, the debugging output is duplicated: once for non-verbose mode and then for verbose mode.

>>> import re
>>> re.compile(r' (?x)a', re.DEBUG)
LITERAL 32
LITERAL 97
LITERAL 97
re.compile(' (?x)a', re.VERBOSE|re.DEBUG)

Proposed patch makes the parser to produce only final output for verbose mode.

>>> re.compile(r' (?x)a', re.DEBUG)
LITERAL 97
re.compile(' (?x)a', re.VERBOSE|re.DEBUG)
msg261236 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-03-06 07:18
New changeset 910d0256601f by Serhiy Storchaka in branch '3.5':
Issue #26475: Fixed debugging output for regular expressions with the (?x) flag.
https://hg.python.org/cpython/rev/910d0256601f

New changeset b8928725e8cc by Serhiy Storchaka in branch '2.7':
Issue #26475: Fixed debugging output for regular expressions with the (?x) flag.
https://hg.python.org/cpython/rev/b8928725e8cc

New changeset 37cdbe0a16a4 by Serhiy Storchaka in branch 'default':
Issue #26475: Fixed debugging output for regular expressions with the (?x) flag.
https://hg.python.org/cpython/rev/37cdbe0a16a4
History
Date User Action Args
2022-04-11 14:58:28adminsetgithub: 70662
2016-03-06 07:18:28serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2016-03-06 07:18:07python-devsetnosy: + python-dev
messages: + msg261236
2016-03-03 08:19:16serhiy.storchakacreate