]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39825: Fixes sysconfig.get_config_var('EXT_SUFFIX') on Windows to match distutils...
authorMatti Picus <matti.picus@gmail.com>
Mon, 7 Dec 2020 17:33:20 +0000 (19:33 +0200)
committerGitHub <noreply@github.com>
Mon, 7 Dec 2020 17:33:20 +0000 (17:33 +0000)
Lib/sysconfig.py
Lib/test/test_sysconfig.py
Misc/NEWS.d/next/Library/2020-10-20-08-28-26.bpo-39825.n6KnG0.rst [new file with mode: 0644]

index 6c87b06634c4579ce82eb90ea1f755b5c4c0b2a8..e1b2f93f876d78afae4aedaf8d083e8a9a9f1b1d 100644 (file)
@@ -424,10 +424,11 @@ def _init_posix(vars):
 def _init_non_posix(vars):
     """Initialize the module as appropriate for NT"""
     # set basic install directories
+    import _imp
     vars['LIBDEST'] = get_path('stdlib')
     vars['BINLIBDEST'] = get_path('platstdlib')
     vars['INCLUDEPY'] = get_path('include')
-    vars['EXT_SUFFIX'] = '.pyd'
+    vars['EXT_SUFFIX'] = _imp.extension_suffixes()[0]
     vars['EXE'] = '.exe'
     vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT
     vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable))
index d07d28df607ce702da2e88950732953a31ff5920..352dbdea817e632e5df3102587b33e5d231fe2c1 100644 (file)
@@ -360,10 +360,12 @@ class TestSysConfig(unittest.TestCase):
 
     @unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
                      'EXT_SUFFIX required for this test')
-    def test_SO_in_vars(self):
+    def test_EXT_SUFFIX_in_vars(self):
+        import _imp
         vars = sysconfig.get_config_vars()
         self.assertIsNotNone(vars['SO'])
         self.assertEqual(vars['SO'], vars['EXT_SUFFIX'])
+        self.assertEqual(vars['EXT_SUFFIX'], _imp.extension_suffixes()[0])
 
     @unittest.skipUnless(sys.platform == 'linux' and
                          hasattr(sys.implementation, '_multiarch'),
diff --git a/Misc/NEWS.d/next/Library/2020-10-20-08-28-26.bpo-39825.n6KnG0.rst b/Misc/NEWS.d/next/Library/2020-10-20-08-28-26.bpo-39825.n6KnG0.rst
new file mode 100644 (file)
index 0000000..c337731
--- /dev/null
@@ -0,0 +1,5 @@
+Windows: Change ``sysconfig.get_config_var('EXT_SUFFIX')`` to the expected
+full ``platform_tag.extension`` format. Previously it was hard-coded to
+``.pyd``, now it is compatible with ``distutils.sysconfig`` and will result
+in something like ``.cp38-win_amd64.pyd``. This brings windows into
+conformance with the other platforms.