python / python/mypy

Missing column number for error in return type

Open
#13,932 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Bug Report

In some cases, mypy doesn't show the column number for errors in the return type.

To Reproduce

import typing


def test1() -> typing.undefined:
    pass


def test2() -> undefined:
    pass

Expected Behavior

mypy always shows a column number if --show-column-numbers is used.

Actual Behavior

The column number is missing for the return type typing.undefined:

$ mypy --show-column-numbers test.py
test.py:4: error: Name "typing.undefined" is not defined
test.py:8:16: error: Name "undefined" is not defined

Your Environment

  • Mypy version used: 0.982
  • Mypy command-line flags: --show-column-numbers
  • Python version used: 3.10.8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided test.py example and the mypy --show-column-numbers command. Trace how errors in return annotations are reported, then verify that both typing.undefined and undefined include column numbers in the output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.