Skip to content

Commit 25d5cb5

Browse files
committed
Fix stubgen mypyc type mismatch (#6642)
find_module_path_and_all_py3 promises to return __all__ as a List, but __all__ could be a tuple or something. Make sure to convert it. Fixes #6639.
1 parent 36200d2 commit 25d5cb5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mypy/stubutil.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ def find_module_path_and_all_py3(module: str) -> Optional[Tuple[str, Optional[Li
129129
raise CantImport(module)
130130
if is_c_module(mod):
131131
return None
132-
return mod.__file__, getattr(mod, '__all__', None)
132+
module_all = getattr(mod, '__all__', None)
133+
if module_all is not None:
134+
module_all = list(module_all)
135+
return mod.__file__, module_all
133136

134137

135138
@contextmanager

0 commit comments

Comments
 (0)