Repository navigation
AttributeError when mypy.ini contains disabled_error_codes #16002
Copy link
Copy link
Closed
Labels
Description
Crash Report
mypy crashes if disabled_error_codes is in mypy.ini.
Traceback
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
File "<frozen runpy>", line 226, in run_module
File "<frozen runpy>", line 98, in _run_module_code
File "<frozen runpy>", line 88, in _run_code
File "/home/cebtenzzre/src/forks/mypy/mypy/__main__.py", line 37, in <module>
console_entry()
File "/home/cebtenzzre/src/forks/mypy/mypy/__main__.py", line 15, in console_entry
main()
File "/home/cebtenzzre/src/forks/mypy/mypy/main.py", line 99, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cebtenzzre/src/forks/mypy/mypy/main.py", line 178, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cebtenzzre/src/forks/mypy/mypy/build.py", line 189, in build
result = _build(
^^^^^^^
File "/home/cebtenzzre/src/forks/mypy/mypy/build.py", line 262, in _build
graph = dispatch(sources, manager, stdout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cebtenzzre/src/forks/mypy/mypy/build.py", line 2938, in dispatch
process_graph(graph, manager)
File "/home/cebtenzzre/src/forks/mypy/mypy/build.py", line 3336, in process_graph
process_stale_scc(graph, scc, manager)
File "/home/cebtenzzre/src/forks/mypy/mypy/build.py", line 3459, in process_stale_scc
graph[id].write_cache()
File "/home/cebtenzzre/src/forks/mypy/mypy/build.py", line 2499, in write_cache
new_interface_hash, self.meta = write_cache(
^^^^^^^^^^^^
File "/home/cebtenzzre/src/forks/mypy/mypy/build.py", line 1627, in write_cache
"options": options.select_options_affecting_cache(),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cebtenzzre/src/forks/mypy/mypy/options.py", line 545, in select_options_affecting_cache
val = sorted([code.code for code in val])
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cebtenzzre/src/forks/mypy/mypy/options.py", line 545, in <listcomp>
val = sorted([code.code for code in val])
^^^^^^^^^
AttributeError: 'str' object has no attribute 'code'. Did you mean: 'encode'?
To Reproduce
- Create repr.py containing anything (I put
pass) - Create this mypy.ini:
[mypy]
disabled_error_codes = import-untyped- Run
mypy repr.py
Your Environment
- Mypy version used:
mypy 1.7.0+dev.9a0aca14724eeef580eefcd3b340678313a1930a (compiled: no) - Python version used: Python 3.11.3
- Operating system and version: Arch Linux
Reactions are currently unavailable
Activity
hauntsaninja commentedon Aug 31, 2023
Oh lol, the option name is "disable_error_code", but because of annoying reasons mypy's config parsing sort of accepts the other phrasing. Easy to fix
Fix crash when parsing error code config with typo
Fix crash when parsing error code config with typo (#16005)