https://github.com/python/cpython/commit/5cb7c39e6378d6cfd2bca140aa1eebf72cc7ffd3
commit: 5cb7c39e6378d6cfd2bca140aa1eebf72cc7ffd3
branch: main
author: Evan A Mavrin <[email protected]>
committer: chris-eibl <[email protected]>
date: 2026-08-29T18:02:26+02:00
summary:
gh-154200: Use sysconfig.get_platform() in test_importlib.test_windows (#154210)
instead of a port of distutils.util.get_platform()
files:
M Lib/test/test_importlib/test_windows.py
diff --git a/Lib/test/test_importlib/test_windows.py
b/Lib/test/test_importlib/test_windows.py
index bef4fb46f859a4..146a7394b2b648 100644
--- a/Lib/test/test_importlib/test_windows.py
+++ b/Lib/test/test_importlib/test_windows.py
@@ -4,6 +4,7 @@
import os
import re
import sys
+import sysconfig
import unittest
from test import support
from test.support import import_helper
@@ -17,25 +18,6 @@
EnumKey, CloseKey, DeleteKey, OpenKey
)
-def get_platform():
- # Port of distutils.util.get_platform().
- TARGET_TO_PLAT = {
- 'x86' : 'win32',
- 'x64' : 'win-amd64',
- 'arm' : 'win-arm32',
- }
- if ('VSCMD_ARG_TGT_ARCH' in os.environ and
- os.environ['VSCMD_ARG_TGT_ARCH'] in TARGET_TO_PLAT):
- return TARGET_TO_PLAT[os.environ['VSCMD_ARG_TGT_ARCH']]
- elif 'amd64' in sys.version.lower():
- return 'win-amd64'
- elif '(arm)' in sys.version.lower():
- return 'win-arm32'
- elif '(arm64)' in sys.version.lower():
- return 'win-arm64'
- else:
- return sys.platform
-
def delete_registry_tree(root, subkey):
try:
hkey = OpenKey(root, subkey, access=KEY_ALL_ACCESS)
@@ -143,7 +125,7 @@ def test_tagged_suffix(self):
suffixes = self.machinery.EXTENSION_SUFFIXES
abi_flags = "t" if support.Py_GIL_DISABLED else ""
ver = sys.version_info
- platform = re.sub('[^a-zA-Z0-9]', '_', get_platform())
+ platform = re.sub('[^a-zA-Z0-9]', '_', sysconfig.get_platform())
expected_tag = f".cp{ver.major}{ver.minor}{abi_flags}-{platform}.pyd"
try:
untagged_i = suffixes.index(".pyd")
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]