mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +00:00
gh-133143: Add sys.abi_info (GH-137476)
This makes information about the interpreter ABI more accessible. Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
parent
c006a623e7
commit
1acb718ea2
5 changed files with 137 additions and 0 deletions
|
|
@ -739,6 +739,20 @@ def test_thread_info(self):
|
|||
elif sys.platform == "wasi":
|
||||
self.assertEqual(info.name, "pthread-stubs")
|
||||
|
||||
def test_abi_info(self):
|
||||
info = sys.abi_info
|
||||
self.assertEqual(len(info.__dict__), 4)
|
||||
pointer_bits = 64 if sys.maxsize > 2**32 else 32
|
||||
self.assertEqual(info.pointer_bits, pointer_bits)
|
||||
self.assertEqual(info.byteorder, sys.byteorder)
|
||||
for attr, flag in [
|
||||
("free_threaded", "Py_GIL_DISABLED"),
|
||||
("debug", "Py_DEBUG"),
|
||||
]:
|
||||
self.assertEqual(getattr(info, attr, None),
|
||||
bool(sysconfig.get_config_var(flag)),
|
||||
f"for {attr}")
|
||||
|
||||
@unittest.skipUnless(support.is_emscripten, "only available on Emscripten")
|
||||
def test_emscripten_info(self):
|
||||
self.assertEqual(len(sys._emscripten_info), 4)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue