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

Fix re debugging output #66605

Closed
serhiy-storchaka opened this issue Sep 15, 2014 · 4 comments
Closed

Fix re debugging output #66605

serhiy-storchaka opened this issue Sep 15, 2014 · 4 comments
Assignees
Labels
stdlib Python modules in the Lib dir topic-regex type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 22415
Nosy @pitrou, @ezio-melotti, @serhiy-storchaka
Files
  • re_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 2014-09-21.19:53:36.170>
    created_at = <Date 2014-09-15.08:07:14.890>
    labels = ['expert-regex', 'type-bug', 'library']
    title = 'Fix re debugging output'
    updated_at = <Date 2014-09-21.20:02:11.461>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2014-09-21.20:02:11.461>
    actor = 'python-dev'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2014-09-21.19:53:36.170>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)', 'Regular Expressions']
    creation = <Date 2014-09-15.08:07:14.890>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['36620']
    hgrepos = []
    issue_num = 22415
    keywords = ['patch']
    message_count = 4.0
    messages = ['226903', '227034', '227231', '227232']
    nosy_count = 5.0
    nosy_names = ['pitrou', '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/issue22415'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    @serhiy-storchaka
    Copy link
    Member Author

    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

    1. Got rid of trailing spaces in Python 3.

    2. Used named opcode constants instead of inlined strings.

    3. Simplified and modernized the code.

    4. Updated test to cover more code.

    @serhiy-storchaka serhiy-storchaka added stdlib Python modules in the Lib dir topic-regex type-bug An unexpected behavior, bug, or error labels Sep 15, 2014
    @serhiy-storchaka
    Copy link
    Member Author

    If there are no objections I'll commit the patch soon.

    @serhiy-storchaka serhiy-storchaka self-assigned this Sep 18, 2014
    @serhiy-storchaka
    Copy link
    Member Author

    Committed with Antoine's suggestion. Thank you Antoine.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 21, 2014

    New changeset d4630b1c8792 by Serhiy Storchaka in branch '2.7':
    Fixed issue bpo-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 bpo-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 bpo-22415 number in Misc/NEWS for changeset fe287268e97b.
    https://hg.python.org/cpython/rev/fb93a04832df

    @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
    stdlib Python modules in the Lib dir topic-regex type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant