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

Conversation

colesbury
Copy link
Contributor

@colesbury colesbury commented Oct 5, 2023

Use "t" in the expected tag for --disable-gil builds in test_tagged_suffix.

…ures

Use "t" in the expected tag for `--disable-gil` builds in test_tagged_suffix.
@colesbury
Copy link
Contributor Author

colesbury commented Oct 5, 2023

cc @itamaro - this fixes one of the two Windows --disable-gil buildbot failures. I'm still trying to reproduce the test_peg_generator failures.

(EDIT: s/test_importlib/test_peg_generator)

Comment on lines 115 to 118
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"

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -111,8 +112,10 @@ 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,
re.sub('[^a-zA-Z0-9]', '_', get_platform()))
abi_flags = "t" if sysconfig.get_config_var("Py_NOGIL") else ""
Copy link
Member

Choose a reason for hiding this comment

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

Now I'm confused. On Windows, sys.abiflags doesn't exist? It doesn't look practical that sys.abiflags doesn't exist to look for PYD files :-(

Maybe we should now add this flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The awkward bit is that debug libraries are indicated as a _d prefix like, foo_d.cp313t-win_amd64.pyd instead of as part of the abiflags. Still might be useful.

Copy link
Member

Choose a reason for hiding this comment

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

We can maybe change that in Python 3.13 to make it consistent.

@vstinner vstinner enabled auto-merge (squash) October 5, 2023 19:43
@vstinner vstinner merged commit 3c2f321 into python:main Oct 5, 2023
22 checks passed
@colesbury colesbury deleted the disable_gil_win branch October 6, 2023 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants