GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Error message for walrus etc. in PEP 695 contexts could be improved · Issue #104572 · python/cpython

Error message for walrus etc. in PEP 695 contexts could be improved #104572

New issue
Copy link
New issue
Copy link
Closed
Closed
Error message for walrus etc. in PEP 695 contexts could be improved#104572
Copy link
Assignees
JelleZijlstra
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@JelleZijlstra
JelleZijlstra
opened on May 17, 2023
Issue body actions

Before:

>>> type A[T: (x:=3)] = int
  File "<stdin>", line 1
SyntaxError: 'named expression' can not be used within a TypeVar bound

After:

>>> type A[T: (x:=3)] = int
  File "<stdin>", line 1
SyntaxError: named expression cannot be used within a TypeVar bound

("cannot" is one word; the quotes don't really make sense here)

Linked PRs

  • gh-104572: Improve error messages for invalid constructs in PEP 695 contexts #104573

Activity

  1. JelleZijlstra
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    topic-typing
    on May 17, 2023
  2. JelleZijlstra
    self-assigned this
    on May 17, 2023
  3. JelleZijlstra
    added a commit that references this issue on May 17, 2023

    pythongh-104572: Improve error messages for invalid constructs in PEP…

    9daa1af
  4. JelleZijlstra commented on May 17, 2023

    @JelleZijlstra
    JelleZijlstra
    on May 17, 2023
    MemberAuthor
    More actions

    It would also be nice if the error display had a ^ pointing to the precise location. Unfortunately that appears to be difficult, as the error is raised in symtable.c where we no longer have access to the original source. The same thing happens with other syntax errors raised in symtable.c:

    >>> def f(a, a): pass
    ... 
      File "<stdin>", line 1
    SyntaxError: duplicate argument 'a' in function definition
    
  5. terryjreedy commented on May 17, 2023

    @terryjreedy
    terryjreedy
    on May 17, 2023
    Member
    More actions

    The quotes might have come from thinking of 'named expression' as a grammar target, but then it would have to really be in the doc grammar and would need a hyphen. Error messages should save quotes for quotes from the code, as with 'a' above.

  6. JelleZijlstra
    added a commit that references this issue on May 17, 2023

    gh-104572: Improve error messages for invalid constructs in PEP 695 c…

    97db2f3
  7. carljm
    added a commit that references this issue on May 17, 2023

    Merge branch 'main' into 709funconly

    b1bb3a7
  8. AlexWaygood
    closed this as completedon May 17, 2023
  9. JelleZijlstra
    added a commit that references this issue on May 18, 2023

    pythongh-104572: Improve error messages for invalid constructs in PEP…

    dc957c7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @JelleZijlstra
    JelleZijlstra

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.