File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -382,22 +382,25 @@ def addsitedir(sitedir, known_paths=None):
382382 except OSError :
383383 return
384384
385- # Phase 1: Discover .start files and accumulate their entry points.
386- start_names = sorted (
387- name for name in names
388- if name .endswith (".start" ) and not name .startswith ("." )
389- )
390- for name in start_names :
391- _read_start_file (sitedir , name )
392-
393- # Phase 2: Read .pth files, accumulating paths and import lines.
385+ # The following phases are defined by PEP 829.
386+ # Phases 1-3: Read .pth files, accumulating paths and import lines.
394387 pth_names = sorted (
395388 name for name in names
396389 if name .endswith (".pth" ) and not name .startswith ("." )
397390 )
398391 for name in pth_names :
399392 _read_pth_file (sitedir , name , known_paths )
400393
394+ # Phases 6-7: Discover .start files and accumulate their entry points.
395+ # Import lines from .pth files with a matching .start file are discarded
396+ # at flush time by _exec_imports().
397+ start_names = sorted (
398+ name for name in names
399+ if name .endswith (".start" ) and not name .startswith ("." )
400+ )
401+ for name in start_names :
402+ _read_start_file (sitedir , name )
403+
401404 # If standalone call (not from main()), flush immediately
402405 # so the caller sees the effect.
403406 if reset :
You can’t perform that action at this time.
0 commit comments