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

Parser stack overflows #77330

Closed
IsaacElliott mannequin opened this issue Mar 26, 2018 · 3 comments
Closed

Parser stack overflows #77330

IsaacElliott mannequin opened this issue Mar 26, 2018 · 3 comments

Comments

@IsaacElliott
Copy link
Mannequin

IsaacElliott mannequin commented Mar 26, 2018

BPO 33149
Nosy @pablogsal
Superseder
  • bpo-3971: s_push: parser stack overflow MemoryError
  • 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 = None
    closed_at = <Date 2018-03-27.14:41:15.882>
    created_at = <Date 2018-03-26.23:57:23.547>
    labels = []
    title = 'Parser stack overflows'
    updated_at = <Date 2018-03-27.14:41:15.882>
    user = 'https://bugs.python.org/IsaacElliott'

    bugs.python.org fields:

    activity = <Date 2018-03-27.14:41:15.882>
    actor = 'ned.deily'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-03-27.14:41:15.882>
    closer = 'ned.deily'
    components = []
    creation = <Date 2018-03-26.23:57:23.547>
    creator = 'Isaac Elliott'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33149
    keywords = []
    message_count = 3.0
    messages = ['314485', '314486', '314497']
    nosy_count = 2.0
    nosy_names = ['Isaac Elliott', 'pablogsal']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '3971'
    type = None
    url = 'https://bugs.python.org/issue33149'
    versions = ['Python 3.6']

    @IsaacElliott
    Copy link
    Mannequin Author

    IsaacElliott mannequin commented Mar 26, 2018

    python3's parser stack overflows on deeply-nested expressions, for example:

    [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]

    or

    aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa()))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

    These are both minimal examples, so if you remove one level of nesting from either then python3 will behave normally.

    @IsaacElliott
    Copy link
    Mannequin Author

    IsaacElliott mannequin commented Mar 27, 2018

    Because of the way recursive descent parsing works,

    [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[

    is actually the minimal input required to reproduce this in python3.

    In python2, the bug is still present, but requires a slightly deeper nesting:

    [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[

    @pablogsal
    Copy link
    Member

    Duplicate of bpo-3971

    @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
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants