cpython
cpython copied to clipboard
gh-99201: fix IndexError when initializing sysconfig config variables
- Issue: gh-99201
@philthompson10, can you confirm this fixes your issue?
On 09/11/2022 03:36, Filipe Laíns wrote:
@philthompson10, can you confirm this fixes your issue?
Yes but I think a safer fix would be to set vars['EXT_SUFFIX'] to None or ''. There might be code that is expecting the dict to have a value with that key (as it currently does in all circumstances) and also that that value is a string.
Phil
The existence of EXT_SUFFIX
is not guaranteed, as it is not documented anywhere. People expecting it to be there is the reason why I think we shouldn't set it at all. Returning None
will make code that uses the string value of the returned object misbehave (eg. f'my_extension{sysconfig.get_config_var("EXT_SUFFIX")}'
will be my_extensionNone
), so raising a KeyError
in these situations is more desirable.