From d510dbab356286db2d6f713b3b2f2f86ae702783 Mon Sep 17 00:00:00 2001 From: "Michael J. Sullivan" Date: Thu, 13 Aug 2020 14:33:30 -0700 Subject: [PATCH] Don't infinite loop on self deps in --follow-imports=normal There are situations in complex SCCs where the semantic analyzer will infer self dependencies, which will cause an infinite loop in dmypy --follow-imports=normal. It's probably a bug that we do that, and that should be fixed to, but fixing a graph algorithm to not infinite loop on self edges seems like a reasonable thing to do in any case. I don't have a minimized test case yet, and am submitting this without one because it should be harmless and because I want it to get into the release. --- mypy/dmypy_server.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mypy/dmypy_server.py b/mypy/dmypy_server.py index 52db838d038e..157850b39ee9 100644 --- a/mypy/dmypy_server.py +++ b/mypy/dmypy_server.py @@ -557,6 +557,10 @@ def fine_grained_increment_follow_imports(self, sources: List[BuildSource]) -> L if module[0] not in graph: continue sources2 = self.direct_imports(module, graph) + # Filter anything already seen before. This prevents + # infinite looping if there are any self edges. (Self + # edges are maybe a bug, but...) + sources2 = [source for source in sources2 if source.module not in seen] changed, new_files = self.find_reachable_changed_modules( sources2, graph, seen, changed_paths ) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy