Skip to content

Commit 31b7eab

Browse files
committed
Add ABIFLAGS to sysconfig.get_config_vars() on Windows
1 parent 972a295 commit 31b7eab

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

Lib/sysconfig/__init__.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,13 @@ def _init_non_posix(vars):
414414
vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable))
415415
vars['TZPATH'] = ''
416416

417+
abiflags = vars['abi_thread']
418+
if vars['EXT_SUFFIX'].endswith('_d.'):
419+
abiflags += 'd'
420+
# Do not touch lower-cased `abiflags` here.
421+
# sys.abiflags is absent on Windows. So vars['abiflags'] should be empty.
422+
vars['ABIFLAGS'] = abiflags
423+
417424
#
418425
# public APIs
419426
#
@@ -541,6 +548,9 @@ def _init_config_vars():
541548
except AttributeError:
542549
_CONFIG_VARS['py_version_nodot_plat'] = ''
543550

551+
# e.g., 't' for free-threaded or '' for default build
552+
_CONFIG_VARS['abi_thread'] = 't' if _CONFIG_VARS.get('Py_GIL_DISABLED') else ''
553+
544554
if os.name == 'nt':
545555
_init_non_posix(_CONFIG_VARS)
546556
_CONFIG_VARS['VPATH'] = sys._vpath
@@ -550,9 +560,6 @@ def _init_config_vars():
550560
# the init-function.
551561
_CONFIG_VARS['userbase'] = _getuserbase()
552562

553-
# e.g., 't' for free-threaded or '' for default build
554-
_CONFIG_VARS['abi_thread'] = 't' if _CONFIG_VARS.get('Py_GIL_DISABLED') else ''
555-
556563
# Always convert srcdir to an absolute path
557564
srcdir = _CONFIG_VARS.get('srcdir', _PROJECT_BASE)
558565
if os.name == 'posix':

0 commit comments

Comments
 (0)