Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading debugging output for verbose regular expressions #70662

Closed
serhiy-storchaka opened this issue Mar 3, 2016 · 2 comments
Closed

Misleading debugging output for verbose regular expressions #70662

serhiy-storchaka opened this issue Mar 3, 2016 · 2 comments
Assignees
Labels
topic-regex type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 26475
Nosy @ezio-melotti, @serhiy-storchaka
Files
  • re_verbose_debug.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2016-03-06.07:18:28.449>
    created_at = <Date 2016-03-03.08:19:16.569>
    labels = ['expert-regex', 'type-bug']
    title = 'Misleading debugging output for verbose regular expressions'
    updated_at = <Date 2016-03-06.07:18:28.449>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2016-03-06.07:18:28.449>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2016-03-06.07:18:28.449>
    closer = 'serhiy.storchaka'
    components = ['Regular Expressions']
    creation = <Date 2016-03-03.08:19:16.569>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['42066']
    hgrepos = []
    issue_num = 26475
    keywords = ['patch']
    message_count = 2.0
    messages = ['261148', '261236']
    nosy_count = 4.0
    nosy_names = ['ezio.melotti', 'mrabarnett', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue26475'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6']

    @serhiy-storchaka
    Copy link
    Member Author

    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)

    @serhiy-storchaka serhiy-storchaka self-assigned this Mar 3, 2016
    @serhiy-storchaka serhiy-storchaka added topic-regex type-bug An unexpected behavior, bug, or error labels Mar 3, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 6, 2016

    New changeset 910d0256601f by Serhiy Storchaka in branch '3.5':
    Issue bpo-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 bpo-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 bpo-26475: Fixed debugging output for regular expressions with the (?x) flag.
    https://hg.python.org/cpython/rev/37cdbe0a16a4

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    topic-regex type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant