New submission from Serhiy Storchaka:
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)
----------
assignee: serhiy.storchaka
components: Regular Expressions
files: re_verbose_debug.patch
keywords: patch
messages: 261148
nosy: ezio.melotti, mrabarnett, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Misleading debugging output for verbose regular expressions
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file42066/re_verbose_debug.patch
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26475>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com