Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fd8a15e

Browse filesBrowse files
authored
Make order of processing the builtins SCC predictable (#12431)
Various things can go wrong if the order of modules in the builtins SCC that also includes typing, _typeshed and others is adjusted. Hopefully fixes #12422. May also fix #12421.
1 parent efe9a31 commit fd8a15e
Copy full SHA for fd8a15e

File tree

Expand file treeCollapse file tree

1 file changed

+9
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-5
lines changed

‎mypy/build.py

Copy file name to clipboardExpand all lines: mypy/build.py
+9-5Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2965,12 +2965,16 @@ def process_graph(graph: Graph, manager: BuildManager) -> None:
29652965
# Order the SCC's nodes using a heuristic.
29662966
# Note that ascc is a set, and scc is a list.
29672967
scc = order_ascc(graph, ascc)
2968-
# If builtins is in the list, move it last. (This is a bit of
2969-
# a hack, but it's necessary because the builtins module is
2970-
# part of a small cycle involving at least {builtins, abc,
2971-
# typing}. Of these, builtins must be processed last or else
2972-
# some builtin objects will be incompletely processed.)
2968+
# Make the order of the SCC that includes 'builtins' and 'typing',
2969+
# among other things, predictable. Various things may break if
2970+
# the order changes.
29732971
if 'builtins' in ascc:
2972+
scc = sorted(scc, reverse=True)
2973+
# If builtins is in the list, move it last. (This is a bit of
2974+
# a hack, but it's necessary because the builtins module is
2975+
# part of a small cycle involving at least {builtins, abc,
2976+
# typing}. Of these, builtins must be processed last or else
2977+
# some builtin objects will be incompletely processed.)
29742978
scc.remove('builtins')
29752979
scc.append('builtins')
29762980
if manager.options.verbosity >= 2:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.