classification
Title: Fix re debugging output
Type: behavior Stage: resolved
Components: Library (Lib), Regular Expressions Versions: Python 3.5, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: ezio.melotti, mrabarnett, pitrou, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2014-09-15 08:07 by serhiy.storchaka, last changed 2014-09-21 20:02 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
re_debug.patch serhiy.storchaka, 2014-09-15 08:07 review
Messages (4)
msg226903 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-09-15 08:07
Proposed patch fixes some issues in debugging output of the compiling of regular expression with the re.DEBUG flag.

1. Fixed the handling of the GROUPREF_EXISTS opcode.

Example:
>>> re.compile(r'(ab)(?(1)cd|ef)', re.DEBUG)

Before patch ("yes" and "no" branches are not separated):

subpattern 1
  literal 97
  literal 98
subpattern None
  groupref_exists 1
    literal 99
    literal 100
    literal 101
    literal 102

After patch:

subpattern 1
  literal 97
  literal 98
subpattern None
  groupref_exists 1
    literal 99
    literal 100
  or
    literal 101
    literal 102

2. Got rid of trailing spaces in Python 3.

3. Used named opcode constants instead of inlined strings.

4. Simplified and modernized the code.

5. Updated test to cover more code.
msg227034 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-09-18 09:56
If there are no objections I'll commit the patch soon.
msg227231 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-09-21 19:53
Committed with Antoine's suggestion. Thank you Antoine.
msg227232 - (view) Author: Roundup Robot (python-dev) Date: 2014-09-21 20:02
New changeset d4630b1c8792 by Serhiy Storchaka in branch '2.7':
Fixed issue #22415 number in Misc/NEWS for changeset c925b436467a.
https://hg.python.org/cpython/rev/d4630b1c8792

New changeset 7b92518b2c21 by Serhiy Storchaka in branch '3.4':
Fixed issue #22415 number in Misc/NEWS for changeset e99a1df8db36.
https://hg.python.org/cpython/rev/7b92518b2c21

New changeset fb93a04832df by Serhiy Storchaka in branch 'default':
Fixed issue #22415 number in Misc/NEWS for changeset fe287268e97b.
https://hg.python.org/cpython/rev/fb93a04832df
History
Date User Action Args
2014-09-21 20:02:11python-devsetnosy: + python-dev
messages: + msg227232
2014-09-21 19:53:36serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg227231

stage: patch review -> resolved
2014-09-18 09:56:28serhiy.storchakasetassignee: serhiy.storchaka
messages: + msg227034
2014-09-15 08:07:14serhiy.storchakacreate