Skip to content

Commit 21ae49d

Browse files
committed
Revert "Simplify sys.abiflags in sysconfig and site"
This reverts commit a5739ba.
1 parent a5739ba commit 21ae49d

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

Lib/sysconfig/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,11 @@ def _init_config_vars():
506506
base_prefix = _BASE_PREFIX
507507
base_exec_prefix = _BASE_EXEC_PREFIX
508508

509+
with warnings.catch_warnings():
510+
# ignore DeprecationWarning on sys.abiflags change on Windows
511+
warnings.simplefilter('ignore', DeprecationWarning)
512+
abiflags = getattr(sys, 'abiflags', '')
513+
509514
if os.name == 'posix':
510515
_init_posix(_CONFIG_VARS)
511516
# If we are cross-compiling, load the prefixes from the Makefile instead.
@@ -515,10 +520,6 @@ def _init_config_vars():
515520
base_prefix = _CONFIG_VARS['host_prefix']
516521
base_exec_prefix = _CONFIG_VARS['host_exec_prefix']
517522
abiflags = _CONFIG_VARS['ABIFLAGS']
518-
else:
519-
abiflags = sys.abiflags
520-
else:
521-
abiflags = '' # sys.abiflags is absent on Windows
522523

523524
# Normalized versions of prefix and exec_prefix are handy to have;
524525
# in fact, these are the standard versions used most places in the

Lib/test/test_sys.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -719,9 +719,6 @@ def test_attributes(self):
719719
self.assertIn(sys.float_repr_style, ('short', 'legacy'))
720720
if not sys.platform.startswith('win'):
721721
self.assertIsInstance(sys.abiflags, str)
722-
723-
# test hasattr(sys, 'abiflags') == (os.name != 'nt)
724-
self.assertEqual(os.name, 'posix')
725722
else:
726723
absent = object()
727724
with self.assertWarnsRegex(
@@ -746,9 +743,6 @@ def test_attributes(self):
746743
):
747744
_ = sys.abiflags
748745

749-
# test hasattr(sys, 'abiflags') == (os.name != 'nt)
750-
self.assertEqual(os.name, 'nt')
751-
752746
def test_thread_info(self):
753747
info = sys.thread_info
754748
self.assertEqual(len(info), 3)

0 commit comments

Comments
 (0)