Skip to content

Commit 020998d

Browse files
authored
Only import distutils if it is needed (python#10203)
distutils is deprecated in python 3.10, so we only import it if it is needed, which should only be python < 3.2
1 parent a503132 commit 020998d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypy/sitepkgs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import sys
1212
sys.path = sys.path[1:] # we don't want to pick up mypy.types
1313

14-
from distutils.sysconfig import get_python_lib
1514
import site
1615

1716
MYPY = False
@@ -25,6 +24,7 @@ def getsitepackages():
2524
user_dir = site.getusersitepackages()
2625
return site.getsitepackages() + [user_dir]
2726
else:
27+
from distutils.sysconfig import get_python_lib
2828
return [get_python_lib()]
2929

3030

0 commit comments

Comments
 (0)