Skip to content

Commit

Permalink
Fix pyinfo for Python 3.12 changes (#15103)
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja authored Apr 24, 2023
1 parent ba35026 commit a2b0f18
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions mypy/pyinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
library found in Python 3.7. This file is run each mypy run, so it should be kept as fast as
possible.
"""
import os
import site
import sys
import sysconfig

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

sys.path = old_sys_path

import os
import site
import sysconfig


def getsitepackages() -> list[str]:
res = []
Expand All @@ -31,9 +32,7 @@ def getsitepackages() -> list[str]:
if hasattr(site, "getusersitepackages") and site.ENABLE_USER_SITE:
res.insert(0, site.getusersitepackages())
else:
from distutils.sysconfig import get_python_lib

res = [get_python_lib()]
res = [sysconfig.get_paths()["purelib"]]
return res


Expand Down

0 comments on commit a2b0f18

Please sign in to comment.