[New-bugs-announce] [issue22415] Fix re debugging output

Serhiy Storchaka report at bugs.python.org
Mon Sep 15 10:07:14 CEST 2014


New submission from Serhiy Storchaka:

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.

----------
components: Library (Lib), Regular Expressions
files: re_debug.patch
keywords: patch
messages: 226903
nosy: ezio.melotti, mrabarnett, pitrou, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Fix re debugging output
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36620/re_debug.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22415>
_______________________________________


More information about the New-bugs-announce mailing list