From f8ff389a110484c40be01b3302187bbbf1c712e7 Mon Sep 17 00:00:00 2001 From: Antoine Lecubin Date: Mon, 8 Jun 2020 15:19:27 +0900 Subject: [PATCH 1/3] Update typeshed to fix TextIOWrapper constructor Currently it doesn't accept ZipFile.open()'s output and fails with error: Argument 1 to "TextIOWrapper" has incompatible type "IO[bytes]"; expected "BinaryIO" That was fixed in https://github.com/python/typeshed/commit/3058bec873ef8b2b5630df36c4cbea0e3734dc5f --- mypy/typeshed | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/typeshed b/mypy/typeshed index e199c2e4bc95c..df6136c4ac0bd 160000 --- a/mypy/typeshed +++ b/mypy/typeshed @@ -1 +1 @@ -Subproject commit e199c2e4bc95c4df25f0270cedbee934083f4ae8 +Subproject commit df6136c4ac0bd0751699a7eeeff36e7486a90254 From 0bd34beba459927b2d81e478da450bc57c6d0bbc Mon Sep 17 00:00:00 2001 From: Antoine Lecubin Date: Mon, 8 Jun 2020 15:46:38 +0900 Subject: [PATCH 2/3] Check for None before calling lru_cache'd get_site_packages_dirs --- mypy/modulefinder.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mypy/modulefinder.py b/mypy/modulefinder.py index 55d226cb647ae..3ca1a8db1c308 100644 --- a/mypy/modulefinder.py +++ b/mypy/modulefinder.py @@ -448,7 +448,7 @@ def default_lib_path(data_dir: str, @functools.lru_cache(maxsize=None) -def get_site_packages_dirs(python_executable: Optional[str]) -> Tuple[List[str], List[str]]: +def get_site_packages_dirs(python_executable: str) -> Tuple[List[str], List[str]]: """Find package directories for given python. This runs a subprocess call, which generates a list of the egg directories, and the site @@ -461,8 +461,6 @@ def make_abspath(path: str, root: str) -> str: else: return os.path.join(root, os.path.normpath(path)) - if python_executable is None: - return [], [] if python_executable == sys.executable: # Use running Python's package dirs site_packages = sitepkgs.getsitepackages() @@ -543,7 +541,11 @@ def compute_search_paths(sources: List[BuildSource], if alt_lib_path: mypypath.insert(0, alt_lib_path) - egg_dirs, site_packages = get_site_packages_dirs(options.python_executable) + if options.python_executable is None: + egg_dirs = [] # type: List[str] + site_packages = [] # type: List[str] + else: + egg_dirs, site_packages = get_site_packages_dirs(options.python_executable) for site_dir in site_packages: assert site_dir not in lib_path if (site_dir in mypypath or From def49802e3fe4d0ff879a5653179ceb0cc6ae8c3 Mon Sep 17 00:00:00 2001 From: Antoine Lecubin Date: Mon, 8 Jun 2020 17:28:50 +0900 Subject: [PATCH 3/3] Specify key for sorting BasicBlocks --- mypyc/analysis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypyc/analysis.py b/mypyc/analysis.py index a766b0dee9b82..b71e120dceea8 100644 --- a/mypyc/analysis.py +++ b/mypyc/analysis.py @@ -30,7 +30,7 @@ def __init__(self, def __str__(self) -> str: lines = [] - lines.append('exits: %s' % sorted(self.exits)) + lines.append('exits: %s' % sorted(self.exits, key=lambda e: e.label)) lines.append('succ: %s' % self.succ) lines.append('pred: %s' % self.pred) return '\n'.join(lines)