Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-110119: Fix test_importlib --disable-gil Windows test failures #110422

Merged
merged 2 commits into from
Oct 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Lib/test/test_importlib/test_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import re
import sys
import sysconfig
import unittest
from test.support import import_helper
from contextlib import contextmanager
Expand Down Expand Up @@ -111,7 +112,9 @@ def test_module_not_found(self):
class WindowsExtensionSuffixTests:
def test_tagged_suffix(self):
suffixes = self.machinery.EXTENSION_SUFFIXES
expected_tag = ".cp{0.major}{0.minor}-{1}.pyd".format(sys.version_info,
threading_tag = "t" if sysconfig.get_config_var("Py_NOGIL") else ""
expected_tag = ".cp{0.major}{0.minor}{1}-{2}.pyd".format(sys.version_info,
threading_tag,
re.sub('[^a-zA-Z0-9]', '_', get_platform()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code looks too complicated for what it is. I suggest:

        abi_flags = "t" if sysconfig.get_config_var("Py_NOGIL") else ""
        ver = sys.version_info
        platform = re.sub('[^a-zA-Z0-9]', '_', get_platform())
        expected_tag = f".cp{ver.major}{ver.minor}{abi_flags}-{platform}.pyd"

try:
untagged_i = suffixes.index(".pyd")
Expand Down