File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,7 +47,10 @@ def getsyspath() -> list[str]:
4747 )
4848 stdlib = sysconfig .get_path ("stdlib" )
4949 stdlib_ext = os .path .join (stdlib , "lib-dynload" )
50- excludes = {stdlib_zip , stdlib , stdlib_ext }
50+ # Resolve symlinks: base_exec_prefix / sysconfig paths retain the symlink
51+ # form (e.g. Homebrew's /opt/homebrew/opt/python@3.13) while sys.path
52+ # entries arrive pre-resolved by Python. See python/mypy#21474.
53+ excludes = {os .path .realpath (p ) for p in (stdlib_zip , stdlib , stdlib_ext )}
5154
5255 # Drop the first entry of sys.path
5356 # - If pyinfo.py is executed as a script (in a subprocess), this is the directory
@@ -63,7 +66,7 @@ def getsyspath() -> list[str]:
6366 offset = 0 if sys .version_info >= (3 , 11 ) and sys .flags .safe_path else 1
6467
6568 abs_sys_path = (os .path .abspath (p ) for p in sys .path [offset :])
66- return [p for p in abs_sys_path if p not in excludes ]
69+ return [p for p in abs_sys_path if os . path . realpath ( p ) not in excludes ]
6770
6871
6972def getsearchdirs () -> tuple [list [str ], list [str ]]:
You can’t perform that action at this time.
0 commit comments