Navigation Menu

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

Incorrect line number for syntax error. #88222

Closed
markshannon opened this issue May 6, 2021 · 1 comment
Closed

Incorrect line number for syntax error. #88222

markshannon opened this issue May 6, 2021 · 1 comment
Assignees
Labels
3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) release-blocker type-bug An unexpected behavior, bug, or error

Comments

@markshannon
Copy link
Member

BPO 44056
Nosy @markshannon, @lysnikolaou, @pablogsal
PRs
  • [3.10] bpo-44056: Fix syntax error lineno in try-except #25939
  • 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/markshannon'
    closed_at = <Date 2021-05-07.13:58:20.013>
    created_at = <Date 2021-05-06.11:31:28.231>
    labels = ['interpreter-core', 'type-bug', '3.10', 'release-blocker']
    title = 'Incorrect line number for syntax error.'
    updated_at = <Date 2021-05-07.13:58:20.013>
    user = 'https://github.com/markshannon'

    bugs.python.org fields:

    activity = <Date 2021-05-07.13:58:20.013>
    actor = 'Mark.Shannon'
    assignee = 'Mark.Shannon'
    closed = True
    closed_date = <Date 2021-05-07.13:58:20.013>
    closer = 'Mark.Shannon'
    components = ['Parser']
    creation = <Date 2021-05-06.11:31:28.231>
    creator = 'Mark.Shannon'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44056
    keywords = ['patch']
    message_count = 1.0
    messages = ['393083']
    nosy_count = 3.0
    nosy_names = ['Mark.Shannon', 'lys.nikolaou', 'pablogsal']
    pr_nums = ['25939']
    priority = 'release blocker'
    resolution = 'fixed'
    stage = 'needs patch'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue44056'
    versions = ['Python 3.10']

    @markshannon
    Copy link
    Member Author

    Consider this function, which has a syntax error on line 4.

    >>> def f():
    ...     try: 
    ...         1/0
    ...     except:
    ...         pass
    ...     except Exception: 
    ...         pass

    3.9 reports an incorrect line number of 3.
    3.10b reports an even more incorrect line number of -1.

    Although I've marked this as a "Parser" bug, the offending code is in the compiler.

    For 3.11, this is fixed by #25729

    @markshannon markshannon added 3.10 only security fixes release-blocker labels May 6, 2021
    @markshannon markshannon self-assigned this May 6, 2021
    @markshannon markshannon added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error 3.10 only security fixes release-blocker labels May 6, 2021
    @markshannon markshannon self-assigned this May 6, 2021
    @markshannon markshannon added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels May 6, 2021
    @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.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) release-blocker type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant