Comments (1)
Here's the traceback if you use an uncompiled version of mypy from the master
branch (RecursionError
s cause mypyc to segfault without a traceback):
Traceback
(venv) (master) % mypy -c 'from typing import TypeVar, Callable; T = TypeVar("T", bound=Callable[..., "T"])' --show-traceback
<string>:1: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.10.0+dev.790e8a73d8671a41cae419b4ea07579bfb2bc292
Traceback (most recent call last):
File "/Users/alexw/dev/mypy/venv/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/Users/alexw/dev/mypy/mypy/__main__.py", line 15, in console_entry
main()
File "/Users/alexw/dev/mypy/mypy/main.py", line 100, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "/Users/alexw/dev/mypy/mypy/main.py", line 182, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/Users/alexw/dev/mypy/mypy/build.py", line 192, in build
result = _build(
File "/Users/alexw/dev/mypy/mypy/build.py", line 266, in _build
graph = dispatch(sources, manager, stdout)
File "/Users/alexw/dev/mypy/mypy/build.py", line 2942, in dispatch
process_graph(graph, manager)
File "/Users/alexw/dev/mypy/mypy/build.py", line 3340, in process_graph
process_stale_scc(graph, scc, manager)
File "/Users/alexw/dev/mypy/mypy/build.py", line 3435, in process_stale_scc
mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
File "/Users/alexw/dev/mypy/mypy/semanal_main.py", line 93, in semantic_analysis_for_scc
process_top_levels(graph, scc, patches)
File "/Users/alexw/dev/mypy/mypy/semanal_main.py", line 220, in process_top_levels
deferred, incomplete, progress = semantic_analyze_target(
File "/Users/alexw/dev/mypy/mypy/semanal_main.py", line 349, in semantic_analyze_target
analyzer.refresh_partial(
File "/Users/alexw/dev/mypy/mypy/semanal.py", line 599, in refresh_partial
self.refresh_top_level(node)
File "/Users/alexw/dev/mypy/mypy/semanal.py", line 610, in refresh_top_level
self.accept(d)
File "/Users/alexw/dev/mypy/mypy/semanal.py", line 6588, in accept
node.accept(self)
File "/Users/alexw/dev/mypy/mypy/nodes.py", line 1310, in accept
return visitor.visit_assignment_stmt(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/semanal.py", line 2890, in visit_assignment_stmt
if self.process_typevar_declaration(s):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/semanal.py", line 4122, in process_typevar_declaration
res = self.process_typevar_parameters(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/semanal.py", line 4264, in process_typevar_parameters
tv_arg = self.get_typevarlike_argument("TypeVar", param_name, param_value, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/semanal.py", line 4315, in get_typevarlike_argument
analyzed = self.expr_to_analyzed_type(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/semanal.py", line 6624, in expr_to_analyzed_type
return self.anal_type(
^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/semanal.py", line 6739, in anal_type
typ = typ.accept(a)
^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/types.py", line 964, in accept
return visitor.visit_unbound_type(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/typeanal.py", line 267, in visit_unbound_type
typ = self.visit_unbound_type_nonoptional(t, defining_literal)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/typeanal.py", line 407, in visit_unbound_type_nonoptional
special = self.try_analyze_special_unbound_type(t, fullname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/typeanal.py", line 593, in try_analyze_special_unbound_type
return self.analyze_callable_type(t)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/typeanal.py", line 1386, in analyze_callable_type
return ret.accept(self)
^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/types.py", line 1979, in accept
return visitor.visit_callable_type(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/typeanal.py", line 1043, in visit_callable_type
variables=self.anal_var_defs(variables),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/typeanal.py", line 1734, in anal_var_defs
return [self.anal_var_def(vd) for vd in var_defs]
^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/typeanal.py", line 1724, in anal_var_def
upper_bound=var_def.upper_bound.accept(self),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/types.py", line 1979, in accept
<many lines...>
return visitor.visit_callable_type(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/typeanal.py", line 1043, in visit_callable_type
variables=self.anal_var_defs(variables),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/typeanal.py", line 1734, in anal_var_defs
return [self.anal_var_def(vd) for vd in var_defs]
^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/typeanal.py", line 1724, in anal_var_def
upper_bound=var_def.upper_bound.accept(self),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/types.py", line 1979, in accept
return visitor.visit_callable_type(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/typeanal.py", line 983, in visit_callable_type
with self.tvar_scope_frame():
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 137, in __enter__
return next(self.gen)
^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/typeanal.py", line 1577, in tvar_scope_frame
self.tvar_scope = self.tvar_scope.method_frame()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexw/dev/mypy/mypy/tvar_scope.py", line 90, in method_frame
return TypeVarLikeScope(self, False, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RecursionError: maximum recursion depth exceeded
from mypy.
Related Issues (20)
- unused-courotine should trigger when using a coroutine call as a condition without awaiting it
- `assert_never` fails on match-casing `enum` with only one member
- False Positive when remembering truthiness of a group of values
- mypy incorrectly tags function argument TypeVar with return type when called from a caller with the same signature HOT 2
- Python version check not recognized if sys not named sys HOT 1
- Subclassing generic class with contravariant member HOT 2
- Typing Error for Default Lambda Arg when using Generics
- Can't narrow `Sequence[<X>]` to `Tuple[<X>, ...]` using `isinstance(..., tuple)`
- Option to silence mypy when no issues are found HOT 1
- Tuple types don't work with higher level typing HOT 2
- `Enum` created via functional API should be iterable HOT 2
- Crash when unpacking non TypeVarTuple in args list to `Callable` alias
- no error when importing something that is conditionally defined HOT 3
- Running dmypy as a systemd user service
- Mypy ignores `# type: ignore[override]` on multi-line function definition HOT 4
- Better documentation around using different python versions for different modules
- Mypy fails to typecheck itself following the recent black upgrade
- Allow Callable type hint before function definition HOT 1
- ```ClassVar``` does not work properly with ```staticmethod``` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mypy.