Workaround libc_ver not be available on Windows Store version of Python

This commit is contained in:
pukkandan 2022-09-17 11:57:47 +05:30
parent 9665f15a96
commit dab284f80f
No known key found for this signature in database
GPG Key ID: 7EEE9E1E817D0A39

View File

@ -1966,13 +1966,16 @@ def system_identifier():
python_implementation = platform.python_implementation()
if python_implementation == 'PyPy' and hasattr(sys, 'pypy_version_info'):
python_implementation += ' version %d.%d.%d' % sys.pypy_version_info[:3]
libc_ver = []
with contextlib.suppress(OSError): # We may not have access to the executable
libc_ver = platform.libc_ver()
return 'Python %s (%s %s) - %s %s' % (
platform.python_version(),
python_implementation,
platform.architecture()[0],
platform.platform(),
format_field(join_nonempty(*platform.libc_ver(), delim=' '), None, '(%s)'),
format_field(join_nonempty(*libc_ver, delim=' '), None, '(%s)'),
)