Skip to content

Pegen can't parse some function type comments #84673

Closed

Description

@hauntsaninja
BPO 40493
Nosy @miss-islington, @hauntsaninja
PRs
  • bpo-40493: fix function type comment parsing #19894
  • 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-04.05:09:59.562>
    created_at = <Date 2020-05-04.04:21:40.696>
    labels = []
    title = "Pegen can't parse some function type comments"
    updated_at = <Date 2020-05-04.05:09:59.562>
    user = 'https://github.com/hauntsaninja'

    bugs.python.org fields:

    activity = <Date 2020-05-04.05:09:59.562>
    actor = 'gvanrossum'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-05-04.05:09:59.562>
    closer = 'gvanrossum'
    components = []
    creation = <Date 2020-05-04.04:21:40.696>
    creator = 'hauntsaninja'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40493
    keywords = ['patch']
    message_count = 2.0
    messages = ['368009', '368010']
    nosy_count = 2.0
    nosy_names = ['miss-islington', 'hauntsaninja']
    pr_nums = ['19894']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue40493'
    versions = []

    Activity

    1. hauntsaninja commented on May 4, 2020

      @hauntsaninja
      ContributorAuthor

      Currently fails if we don't have any arguments before *args and **kwargs

      ~ λ python3.9
      Python 3.9.0a6+ (heads/master:c95e691, May  3 2020, 19:57:46) 
      [Clang 11.0.0 (clang-1100.0.33.17)] on darwin
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import ast; ast.parse("(*int) -> None", mode="func_type", type_comments=True)
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/Users/shantanu/.pyenv/versions/3.9-dev/lib/python3.9/ast.py", line 50, in parse
          return compile(source, filename, mode, flags,
        File "<unknown>", line 1
          (*int) -> None
           ^
      SyntaxError: invalid syntax
      
    2. miss-islington commented on May 4, 2020

      @miss-islington
      Contributor

      New changeset 603d354 by Shantanu in branch 'master':
      bpo-40493: fix function type comment parsing (GH-19894)
      603d354

    3. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      No labels
      No labels

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions