Closed
Description
Please provide more information to help us understand the issue:
- Are you reporting a bug, or opening a feature request?
bug - Please insert below the code you are checking with mypy,
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
import sys
from types import TracebackType
from typing import Optional as Opt, Tuple, Type, Union
class Event:
exc_info: Opt[Union[Tuple[Type[BaseException],BaseException,TracebackType],Tuple[None,None,None]]] = None
def foo ( event: Event ) -> None:
try:
assert False
except Exception:
event.exc_info = *sys.exc_info() # mypy crashes on this syntax error
event = Event()
foo ( event )
print ( repr ( event.exc_info ) )
- What is the actual behavior/output?
see traceback below - What is the behavior/output you expect?
report the syntax error without crashing - What are the versions of mypy and Python you are using?
Do you see the same issue after installing mypy from Git master?
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)] on win32
mypy 0.782
Haven't tried master, this bug isn't a show stopper - What are the mypy flags you are using? (For example --strict-optional)
--strict --implicit-reexport
boom.py:12: error: Can use starred expression only as assignment target
boom.py:12: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.782
Traceback (most recent call last):
File "c:\python38-32\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python38-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python38-32\Scripts\mypy.exe\__main__.py", line 7, in <module>
sys.exit(console_entry())
File "c:\python38-32\lib\site-packages\mypy\__main__.py", line 8, in console_entry
main(None, sys.stdout, sys.stderr)
File "c:\python38-32\lib\site-packages\mypy\main.py", line 89, in main
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "c:\python38-32\lib\site-packages\mypy\build.py", line 180, in build
result = _build(
File "c:\python38-32\lib\site-packages\mypy\build.py", line 252, in _build
graph = dispatch(sources, manager, stdout)
File "c:\python38-32\lib\site-packages\mypy\build.py", line 2626, in dispatch
process_graph(graph, manager)
File "c:\python38-32\lib\site-packages\mypy\build.py", line 2949, in process_graph
process_stale_scc(graph, scc, manager)
File "c:\python38-32\lib\site-packages\mypy\build.py", line 3047, in process_stale_scc
graph[id].type_check_first_pass()
File "c:\python38-32\lib\site-packages\mypy\build.py", line 2107, in type_check_first_pass
self.type_checker().check_first_pass()
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 294, in check_first_pass
self.accept(d)
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 401, in accept
stmt.accept(self)
File "c:\python38-32\lib\site-packages\mypy\nodes.py", line 676, in accept
return visitor.visit_func_def(self)
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 726, in visit_func_def
self._visit_func_def(defn)
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 730, in _visit_func_def
self.check_func_item(defn, name=defn.name)
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 792, in check_func_item
self.check_func_def(defn, typ, name)
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 975, in check_func_def
self.accept(item.body)
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 401, in accept
stmt.accept(self)
File "c:\python38-32\lib\site-packages\mypy\nodes.py", line 1004, in accept
return visitor.visit_block(self)
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 1973, in visit_block
self.accept(s)
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 401, in accept
stmt.accept(self)
File "c:\python38-32\lib\site-packages\mypy\nodes.py", line 1234, in accept
return visitor.visit_try_stmt(self)
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 3308, in visit_try_stmt
self.visit_try_without_finally(s, try_frame=bool(s.finally_body))
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 3363, in visit_try_without_finally
self.accept(s.handlers[i])
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 401, in accept
stmt.accept(self)
File "c:\python38-32\lib\site-packages\mypy\nodes.py", line 1004, in accept
return visitor.visit_block(self)
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 1973, in visit_block
self.accept(s)
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 401, in accept
stmt.accept(self)
File "c:\python38-32\lib\site-packages\mypy\nodes.py", line 1062, in accept
return visitor.visit_assignment_stmt(self)
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 2011, in visit_assignment_stmt
self.check_assignment(s.lvalues[-1], s.rvalue, s.type is None, s.new_syntax)
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 2119, in check_assignment
rvalue_type, lvalue_type, infer_lvalue_type = self.check_member_assignment(
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 2974, in check_member_assignment
rvalue_type = self.check_simple_assignment(attribute_type, rvalue, context,
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 2945, in check_simple_assignment
self.check_subtype(rvalue_type, lvalue_type, context, msg,
File "c:\python38-32\lib\site-packages\mypy\checker.py", line 4482, in check_subtype
if is_subtype(subtype, supertype):
File "c:\python38-32\lib\site-packages\mypy\subtypes.py", line 93, in is_subtype
return _is_subtype(left, right,
File "c:\python38-32\lib\site-packages\mypy\subtypes.py", line 118, in _is_subtype
is_subtype_of_item = any(is_subtype(orig_left, item,
File "c:\python38-32\lib\site-packages\mypy\subtypes.py", line 118, in <genexpr>
is_subtype_of_item = any(is_subtype(orig_left, item,
File "c:\python38-32\lib\site-packages\mypy\subtypes.py", line 93, in is_subtype
return _is_subtype(left, right,
File "c:\python38-32\lib\site-packages\mypy\subtypes.py", line 135, in _is_subtype
return left.accept(SubtypeVisitor(orig_right,
File "c:\python38-32\lib\site-packages\mypy\types.py", line 1676, in accept
assert isinstance(visitor, SyntheticTypeVisitor)
AssertionError:
boom.py:12: : note: use --pdb to drop into pdb