gh-99201: fix IndexError when initializing sysconfig config variables

This commit is contained in:
Filipe Laíns 2022-11-19 20:47:09 +00:00 committed by GitHub
parent 858cb79486
commit b0e1f9c241
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -544,7 +544,12 @@ def _init_non_posix(vars):
vars['LIBDEST'] = get_path('stdlib')
vars['BINLIBDEST'] = get_path('platstdlib')
vars['INCLUDEPY'] = get_path('include')
vars['EXT_SUFFIX'] = _imp.extension_suffixes()[0]
try:
# GH-99201: _imp.extension_suffixes may be empty when
# HAVE_DYNAMIC_LOADING is not set. In this case, don't set EXT_SUFFIX.
vars['EXT_SUFFIX'] = _imp.extension_suffixes()[0]
except IndexError:
pass
vars['EXE'] = '.exe'
vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT
vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable))

View File

@ -0,0 +1,2 @@
Fix :exc:`IndexError` when initializing the config variables on Windows if
``HAVE_DYNAMIC_LOADING`` is not set.