-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
Bug Report
After upgrading to 1.16.1 we are seeing occasional AssertionError
s being logged:
$ mypy
mypy 1.16.1 (compiled: yes)
Exception ignored in PyObject_HasAttr(); consider using PyObject_HasAttrWithError(), PyObject_GetOptionalAttr() or PyObject_GetAttr():
Traceback (most recent call last):
File "mypy/nodes.py", line 615, in setter
AssertionError:
... (repeated many times)
It seems like the code introduced in #19248 to fix #19224 makes an assert which is not always true. It seems like the worry expressed in a comment on that PR was justified ;).
To Reproduce
We haven't managed to find a reliable reproducer yet. Switching between branches in our repo and invoking mypy
, sometimes triggers it, but sometimes doesn't.
Expected Behavior
No errors.
Actual Behavior
Errors.
Your Environment
- Mypy version used: 1.6.1
- Mypy command-line flags:
dmypy run -- --cache-dir .mypy_cache/not_recently_touched <explicitly specified list of .py files>
- Mypy configuration options from
mypy.ini
(and other config files):
[tool.mypy]
plugins = [
"pydantic.mypy",
"pydantic.v1.mypy",
"sqlalchemy.ext.mypy.plugin",
"mypy.plugins.proper_plugin",
<a custom mypy plugin>
]
python_version = "3.13"
show_error_codes = true
strict = true
enable_error_code = [
"ignore-without-code",
"redundant-expr",
"redundant-self",
"truthy-bool",
"truthy-iterable",
]
no_implicit_optional = true
warn_unreachable = true
[[tool.mypy.overrides]]
ignore_missing_imports = true
module = [
"asyncpg.*",
]
- Python version used:
$ python --version
Python 3.13.3
DanielNoord, sterliakov and Qqwy