Skip to content

Missing line number error report #19257

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

Open
eliegoudout opened this issue Jun 8, 2025 · 3 comments · May be fixed by #19258
Open

Missing line number error report #19257

eliegoudout opened this issue Jun 8, 2025 · 3 comments · May be fixed by #19258
Assignees
Labels
bug mypy got something wrong topic-error-reporting How we report errors

Comments

@eliegoudout
Copy link

eliegoudout commented Jun 8, 2025

Hi there,

I wanted to know if someone already had this: I have error with no line number, so I don't really know how to debug them. For example, you can this failing pipeline which shows

paramclasses/paramclasses.py: error: Incompatible types in assignment (expression has type "object", variable has type "list[object]")  [assignment]
paramclasses/paramclasses.py: error: Incompatible types in assignment (expression has type "object", variable has type "dict[str, object]")  [assignment]

It's not "global", as before I had errors with and without line numbers

paramclasses/paramclasses.py: error: Incompatible types in assignment (expression has type "object", variable has type "list[Any]")  [assignment]
paramclasses/paramclasses.py: error: Incompatible types in assignment (expression has type "object", variable has type "dict[Any, Any]")  [assignment]
paramclasses/paramclasses.py:272: error: "type" has no attribute "__post_init__"; maybe "__init__"?  [attr-defined]
paramclasses/paramclasses.py:528: error: Need type annotation for "args" (hint: "args: list[<type>] = ...")  [var-annotated]
...

Thanks in advance!
Élie
@eliegoudout eliegoudout added the bug mypy got something wrong label Jun 8, 2025
@eliegoudout
Copy link
Author

eliegoudout commented Jun 8, 2025

After invstigation, I know it comes from the following code:

https://github.com/eliegoudout/paramclasses/blob/902eb276f3046457b9f09ef23a42e2e1ecb897e9/paramclasses/paramclasses.py#L539-L548

Of course, I understand the errors, but I don't really know why there are no lines!

Note however that

# type: ignore[assignment]  # Not statically checked

does not silence the errors!

@brianschubert
Copy link
Collaborator

brianschubert commented Jun 8, 2025

Simplified reproducer:

a: list[int]
b: str
(b,) = (*a,)

outputs:

main.py: error: Incompatible types in assignment (expression has type "int", variable has type "str")  [assignment]

@eliegoudout
Copy link
Author

eliegoudout commented Jun 9, 2025

Thanks for finding a MWE. I think you could also add the # type: ignore[assignment] to complete it (after double-checking, i'm currently unable to, writing from my phone).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-error-reporting How we report errors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants