Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-127405: Add ABIFLAGS to sysconfig.get_config_vars() on Windows#131799
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
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
58 commits Select commit Hold shift + click to select a range
31b7eab Add `ABIFLAGS` to `sysconfig.get_config_vars()` on Windows
XuehaiPan dc45897 📜🤖 Added by blurb_it.
blurb-it[bot] 9a4586a Add tests
XuehaiPan 76c85bb Move `ABIFLAGS` definition to C code
XuehaiPan b98419b Revert now unrelated changes
XuehaiPan 4729f76 Fix variable name
XuehaiPan 04cbb1c Refactor string concatination
XuehaiPan a6045ea Set `Py_DEBUG` flag in sysconfig
XuehaiPan 584e0b0 Update comments from code review
XuehaiPan 93257be Prefer `Py_DEBUG` over `_DEBUG`
XuehaiPan 30c7b56 Add tests
XuehaiPan 97942b2 Add tests
XuehaiPan 917874c Merge branch 'main' into windows-add-sysconfig-abiflags
XuehaiPan f49067e Update tests
XuehaiPan 8fa952b Update tests
XuehaiPan 08d92db Merge branch 'main' into windows-add-sysconfig-abiflags
XuehaiPan b667dd9 Remove unnecessary comments
XuehaiPan 30cf6c7 Merge branch 'main' into windows-add-sysconfig-abiflags
XuehaiPan 5df9540 Update What's New
XuehaiPan 018aae3 Merge branch 'main' into windows-add-sysconfig-abiflags
XuehaiPan 4f22ff3 Revert `PCbuild/pyproject.props`
XuehaiPan f918241 Merge branch 'main' into windows-add-sysconfig-abiflags
XuehaiPan a4646c5 Revert `_DEBUG` -> `Py_DEBUG`
XuehaiPan 7b21d7d Revert `_DEBUG` -> `Py_DEBUG`
XuehaiPan 1ee8230 Add underscore prefix to `d` on Windows
XuehaiPan 084deac Fix key name
XuehaiPan af50632 Add comments for test for `d` flag in `ABIFLAGS`
XuehaiPan b397f40 Fix failing test
XuehaiPan 1a82cd1 Update tests
XuehaiPan 7990798 Merge branch 'main' into windows-add-sysconfig-abiflags
XuehaiPan 0744690 Merge branch 'main' into windows-add-sysconfig-abiflags
XuehaiPan 518137b Add a test for `sysconfig.get_config_var('ABIFLAGS')` on Windows
XuehaiPan 486e2a8 Rename test function
XuehaiPan 3bccf1d Move test location
XuehaiPan 780f340 Move test location
XuehaiPan 98c26f9 Add a note for `test_abiflags`
XuehaiPan e236bc7 Move definition of ABIFLAGS from C to Python
XuehaiPan 0d8bcdd Merge branch 'main' into windows-add-sysconfig-abiflags
XuehaiPan 278556c Merge branch 'main' into windows-add-sysconfig-abiflags
XuehaiPan 5689c1f Merge branch 'main' into windows-add-sysconfig-abiflags
XuehaiPan 299cec6 Update tests
XuehaiPan 21d2e73 Split 't' flag to another test
XuehaiPan d265a59 Update tests
XuehaiPan f3b8570 Update tests
XuehaiPan fe4ea95 Update tests
XuehaiPan da2b4ce Merge branch 'main' into windows-add-sysconfig-abiflags
XuehaiPan 64f0961 Simplify tests
XuehaiPan 8b16454 Simplify tests
XuehaiPan 1c807f0 Update test comments
XuehaiPan fbb86f5 Merge branch 'main' into windows-add-sysconfig-abiflags
XuehaiPan b702ff9 Merge branch 'main' into windows-add-sysconfig-abiflags
XuehaiPan 932386c Simplify test comment
XuehaiPan 23b6e6c Apply suggestions from code review
XuehaiPan 75b6c51 Make 'd' flag test more platform specific
XuehaiPan 3c91201 Merge branch 'main' into windows-add-sysconfig-abiflags
XuehaiPan d55b3e6 Revert non-Windows test changes
XuehaiPan a084070 Fix Windows platform detection
XuehaiPan d2255e6 Merge branch 'main' into windows-add-sysconfig-abiflags
XuehaiPan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -9,6 +9,7 @@ | ||
| import textwrap | ||
| from copy import copy | ||
| from test import support | ||
| from test.support import ( | ||
| captured_stdout, | ||
| is_android, | ||
| @@ -455,20 +456,20 @@ def test_library(self): | ||
| library = sysconfig.get_config_var('LIBRARY') | ||
| ldlibrary = sysconfig.get_config_var('LDLIBRARY') | ||
| major, minor = sys.version_info[:2] | ||
| if sys.platform == 'win32': | ||
| self.assertTrue(library.startswith(f'python{major}{minor}')) | ||
| self.assertTrue(library.endswith('.dll')) | ||
| abiflags = sysconfig.get_config_var('ABIFLAGS') | ||
| if sys.platform.startswith('win'): | ||
| self.assertEqual(library, f'python{major}{minor}{abiflags}.dll') | ||
| self.assertEqual(library, ldlibrary) | ||
| elif is_apple_mobile: | ||
| framework = sysconfig.get_config_var('PYTHONFRAMEWORK') | ||
| self.assertEqual(ldlibrary, f"{framework}.framework/{framework}") | ||
| else: | ||
| self.assertTrue(library.startswith(f'libpython{major}.{minor}')) | ||
| self.assertTrue(library.endswith('.a')) | ||
| self.assertStartsWith(library, f'libpython{major}.{minor}') | ||
| self.assertEndsWith(library, '.a') | ||
| if sys.platform == 'darwin' and sys._framework: | ||
| self.skipTest('gh-110824: skip LDLIBRARY test for framework build') | ||
| else: | ||
| self.assertTrue(ldlibrary.startswith(f'libpython{major}.{minor}')) | ||
| self.assertStartsWith(ldlibrary, f'libpython{major}.{minor}') | ||
| @unittest.skipUnless(sys.platform == "darwin", "test only relevant on MacOSX") | ||
| @requires_subprocess() | ||
| @@ -592,6 +593,63 @@ def test_osx_ext_suffix(self): | ||
| suffix = sysconfig.get_config_var('EXT_SUFFIX') | ||
| self.assertTrue(suffix.endswith('-darwin.so'), suffix) | ||
| def test_always_set_py_debug(self): | ||
| self.assertIn('Py_DEBUG', sysconfig.get_config_vars()) | ||
| Py_DEBUG = sysconfig.get_config_var('Py_DEBUG') | ||
| self.assertIn(Py_DEBUG, (0, 1)) | ||
| self.assertEqual(Py_DEBUG, support.Py_DEBUG) | ||
| def test_always_set_py_gil_disabled(self): | ||
| self.assertIn('Py_GIL_DISABLED', sysconfig.get_config_vars()) | ||
| Py_GIL_DISABLED = sysconfig.get_config_var('Py_GIL_DISABLED') | ||
| self.assertIn(Py_GIL_DISABLED, (0, 1)) | ||
| self.assertEqual(Py_GIL_DISABLED, support.Py_GIL_DISABLED) | ||
| def test_abiflags(self): | ||
XuehaiPan marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| # If this test fails on some platforms, maintainers should update the | ||
| # test to make it pass, rather than changing the definition of ABIFLAGS. | ||
| self.assertIn('abiflags', sysconfig.get_config_vars()) | ||
| self.assertIn('ABIFLAGS', sysconfig.get_config_vars()) | ||
| abiflags = sysconfig.get_config_var('abiflags') | ||
| ABIFLAGS = sysconfig.get_config_var('ABIFLAGS') | ||
| self.assertIsInstance(abiflags, str) | ||
| self.assertIsInstance(ABIFLAGS, str) | ||
| self.assertIn(abiflags, ABIFLAGS) | ||
| if os.name == 'nt': | ||
| self.assertEqual(abiflags, '') | ||
| if not sys.platform.startswith('win'): | ||
| valid_abiflags = ('', 't', 'd', 'td') | ||
| else: | ||
| # Windows uses '_d' rather than 'd' see also test_abi_debug below | ||
| valid_abiflags = ('', 't', '_d', 't_d') | ||
| self.assertIn(ABIFLAGS, valid_abiflags) | ||
| def test_abi_debug(self): | ||
| ABIFLAGS = sysconfig.get_config_var('ABIFLAGS') | ||
| if support.Py_DEBUG: | ||
| self.assertIn('d', ABIFLAGS) | ||
| else: | ||
| self.assertNotIn('d', ABIFLAGS) | ||
| # The 'd' flag should always be the last one on Windows. | ||
| # On Windows, the debug flag is used differently with a underscore prefix. | ||
| # For example, `python{X}.{Y}td` on Unix and `python{X}.{Y}t_d.exe` on Windows. | ||
| if support.Py_DEBUG and sys.platform.startswith('win'): | ||
| self.assertEndsWith(ABIFLAGS, '_d') | ||
| def test_abi_thread(self): | ||
| abi_thread = sysconfig.get_config_var('abi_thread') | ||
| ABIFLAGS = sysconfig.get_config_var('ABIFLAGS') | ||
| self.assertIsInstance(abi_thread, str) | ||
| if support.Py_GIL_DISABLED: | ||
| self.assertEqual(abi_thread, 't') | ||
| self.assertIn('t', ABIFLAGS) | ||
| else: | ||
| self.assertEqual(abi_thread, '') | ||
| self.assertNotIn('t', ABIFLAGS) | ||
| @requires_subprocess() | ||
| def test_makefile_overwrites_config_vars(self): | ||
| script = textwrap.dedent(""" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions 1 Misc/NEWS.d/next/Windows/2025-03-27-16-22-58.gh-issue-127405.aASs2Z.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add ``ABIFLAGS`` to :func:`sysconfig.get_config_vars` on Windows. Patch by Xuehai Pan. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.