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

Support -d flag in the new parser #84927

Closed
pablogsal opened this issue May 24, 2020 · 6 comments
Closed

Support -d flag in the new parser #84927

pablogsal opened this issue May 24, 2020 · 6 comments
Labels
3.9 only security fixes 3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@pablogsal
Copy link
Member

BPO 40750
Nosy @gvanrossum, @lysnikolaou, @pablogsal, @miss-islington
PRs
  • bpo-40750: Support -d flag in the new parser #20340
  • [3.9] bpo-40750: Support -d flag in the new parser (GH-20340) #20392
  • bpo-40750: Do not expand the new parser debug flags if Py_BUILD_CORE is not defined #20393
  • [3.9] bpo-40750: Do not expand the new parser debug flags if Py_BUILD_CORE is not defined (GH-20393) #20394
  • 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 2020-05-25.17:39:00.669>
    created_at = <Date 2020-05-24.01:41:37.357>
    labels = ['interpreter-core', 'type-bug', '3.9', '3.10']
    title = 'Support -d flag in the new parser'
    updated_at = <Date 2020-05-25.19:38:03.335>
    user = 'https://github.com/pablogsal'

    bugs.python.org fields:

    activity = <Date 2020-05-25.19:38:03.335>
    actor = 'miss-islington'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-05-25.17:39:00.669>
    closer = 'pablogsal'
    components = ['Interpreter Core']
    creation = <Date 2020-05-24.01:41:37.357>
    creator = 'pablogsal'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40750
    keywords = ['patch']
    message_count = 6.0
    messages = ['369763', '369764', '369899', '369901', '369908', '369913']
    nosy_count = 4.0
    nosy_names = ['gvanrossum', 'lys.nikolaou', 'pablogsal', 'miss-islington']
    pr_nums = ['20340', '20392', '20393', '20394']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue40750'
    versions = ['Python 3.9', 'Python 3.10']

    @pablogsal
    Copy link
    Member Author

    Python has a (mostly unknown) -d flag that can only be used in debug builds that emit some debug output for the old parser. The new parser does not support such flag. This is very useful when playing with the grammar as it helps enormously to inspect how the parser has behaved and what rules have accepted/rejected in its path.

    @pablogsal pablogsal added 3.9 only security fixes 3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels May 24, 2020
    @pablogsal
    Copy link
    Member Author

    A piece of the output for the string "1 + 1" with PR 20340:

       \> star_expressions[0-0]: star_expression ','
       ✗ star_expressions[0-0]: star_expression ',' failed!
       \> star_expressions[0-0]: star_expression
       ✓ star_expressions[0-3]: star_expression
       \> augassign[3-3]: '+='
       ✗ augassign[3-3]: '+=' failed!
       \> augassign[3-3]: '-='
       ✗ augassign[3-3]: '-=' failed!
       \> augassign[3-3]: '\*='
       ✗ augassign[3-3]: '\*=' failed!
       \> augassign[3-3]: '@='
       ✗ augassign[3-3]: '@=' failed!
       \> augassign[3-3]: '/='
       ✗ augassign[3-3]: '/=' failed!
       \> augassign[3-3]: '%='
       ✗ augassign[3-3]: '%=' failed!
       \> augassign[3-3]: '&='
       ✗ augassign[3-3]: '&=' failed!
       \> augassign[3-3]: '|='
       ✗ augassign[3-3]: '|=' failed!
       \> augassign[3-3]: '^='
       ✗ augassign[3-3]: '^=' failed!
       \> augassign[3-3]: '\<\<='
       ✗ augassign[3-3]: '\<\<=' failed!
       \> augassign[3-3]: '\>\>='
       ✗ augassign[3-3]: '\>\>=' failed!
       \> augassign[3-3]: '\*\*='
       ✗ augassign[3-3]: '\*\*=' failed!
       \> augassign[3-3]: '//='
       ✗ augassign[3-3]: '//=' failed!
      ✗ invalid_assignment[0-0]: star_expressions augassign (yield_expr | star_expressions) failed!
     ✗ assignment[0-0]: invalid_assignment failed!
    ✗ small_stmt[0-0]: assignment failed!
    \> small_stmt[0-0]: star_expressions
     \> star_expressions[0-0]: star_expression ((',' star_expression))+ ','?
      \> \_loop1_71[3-3]: (',' star_expression)
       \> \_tmp_139[3-3]: ',' star_expression
       ✗ \_tmp_139[3-3]: ',' star_expression failed!
      ✗ \_loop1_71[3-3]: (',' star_expression) failed!
     ✗ star_expressions[0-0]: star_expression ((',' star_expression))+ ','? failed!
     \> star_expressions[0-0]: star_expression ','
     ✗ star_expressions[0-0]: star_expression ',' failed!
     \> star_expressions[0-0]: star_expression
     ✓ star_expressions[0-3]: star_expression
    ✓ small_stmt[0-3]: star_expressions
    

    ✓ simple_stmt[0-4]: small_stmt !';' NEWLINE
    ✓ statement_newline[0-4]: simple_stmt
    ✓ interactive[0-4]: statement_newline
    2
    > interactive[0-0]: statement_newline

    @pablogsal
    Copy link
    Member Author

    New changeset 800a35c by Pablo Galindo in branch 'master':
    bpo-40750: Support -d flag in the new parser (GH-20340)
    800a35c

    @miss-islington
    Copy link
    Contributor

    New changeset 82da2c3 by Miss Islington (bot) in branch '3.9':
    bpo-40750: Support -d flag in the new parser (GH-20340)
    82da2c3

    @pablogsal
    Copy link
    Member Author

    New changeset deb4355 by Pablo Galindo in branch 'master':
    bpo-40750: Do not expand the new parser debug flags if Py_BUILD_CORE is not defined (GH-20393)
    deb4355

    @miss-islington
    Copy link
    Contributor

    New changeset 31084be by Miss Islington (bot) in branch '3.9':
    bpo-40750: Do not expand the new parser debug flags if Py_BUILD_CORE is not defined (GH-20393)
    31084be

    @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
    3.9 only security fixes 3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants