Skip to content

Commit a2b0f18

Browse files
authored
Fix pyinfo for Python 3.12 changes (python#15103)
1 parent ba35026 commit a2b0f18

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

mypy/pyinfo.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
library found in Python 3.7. This file is run each mypy run, so it should be kept as fast as
88
possible.
99
"""
10-
import os
11-
import site
1210
import sys
13-
import sysconfig
1411

1512
if __name__ == "__main__":
1613
# HACK: We don't want to pick up mypy.types as the top-level types
@@ -22,6 +19,10 @@
2219

2320
sys.path = old_sys_path
2421

22+
import os
23+
import site
24+
import sysconfig
25+
2526

2627
def getsitepackages() -> list[str]:
2728
res = []
@@ -31,9 +32,7 @@ def getsitepackages() -> list[str]:
3132
if hasattr(site, "getusersitepackages") and site.ENABLE_USER_SITE:
3233
res.insert(0, site.getusersitepackages())
3334
else:
34-
from distutils.sysconfig import get_python_lib
35-
36-
res = [get_python_lib()]
35+
res = [sysconfig.get_paths()["purelib"]]
3736
return res
3837

3938

0 commit comments

Comments
 (0)