File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -5209,8 +5209,17 @@ def test_find_incompatible_extension_modules(self):
52095209 if shlib_suffix := sysconfig .get_config_var ('SHLIB_SUFFIX' ):
52105210 self .assertEqual (last_extension_suffix , shlib_suffix )
52115211 else :
5212- dot , * extensions = last_extension_suffix .split ('.' )
5213- self .assertEqual (dot , '' ) # sanity check
5212+ before_dot , * extensions = last_extension_suffix .split ('.' )
5213+ expected_prefixes = ['' ]
5214+ if os .name == 'nt' :
5215+ # Windows puts the debug tag in the module file stem (eg. foo_d.pyd)
5216+ expected_prefixes .append ('_d' )
5217+ self .assertIn (before_dot , expected_prefixes , msg = (
5218+ f'Unexpected prefix { before_dot !r} in extension module '
5219+ f'suffix { last_extension_suffix !r} . '
5220+ 'traceback._find_incompatible_extension_module needs to be '
5221+ 'updated to take this into account!'
5222+ ))
52145223 # if SHLIB_SUFFIX is not define, we assume the native
52155224 # shared library suffix only contains one extension
52165225 # (eg. '.so', bad eg. '.cpython-315-x86_64-linux-gnu.so')
Original file line number Diff line number Diff line change @@ -1900,6 +1900,10 @@ def _find_incompatible_extension_module(module_name):
19001900 # tests.test_traceback.MiscTest.test_find_incompatible_extension_modules
19011901 # tests that assumption.
19021902 untagged_suffix = importlib .machinery .EXTENSION_SUFFIXES [- 1 ]
1903+ # On Windows the debug tag is part of the module file stem, instead of the
1904+ # extension (eg. foo_d.pyd), so let's remove it and just look for .pyd.
1905+ if os .name == 'nt' :
1906+ untagged_suffix = untagged_suffix .removeprefix ('_d' )
19031907
19041908 parent , _ , child = module_name .rpartition ('.' )
19051909 if parent :
You can’t perform that action at this time.
0 commit comments