Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Doc/library/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,9 @@ always available. Unless explicitly noted otherwise, all variables are read-only
``cache_tag`` is set to ``None``, it indicates that module caching should
be disabled.

*supports_isolated_interpreters* is a boolean value, whether
this implementation supports :pep:`734`. It is always ``True`` for CPython.
Comment thread
sobolevn marked this conversation as resolved.
Resolved

:data:`sys.implementation` may contain additional attributes specific to
the Python implementation. These non-standard attributes must start with
an underscore, and are not described here. Regardless of its contents,
Expand All @@ -1194,6 +1197,9 @@ always available. Unless explicitly noted otherwise, all variables are read-only

.. versionadded:: 3.3

.. versionchanged:: 3.14
Added ``supports_isolated_interpreters`` field.

.. note::

The addition of new required attributes must go through the normal PEP
Expand Down
5 changes: 5 additions & 0 deletions Lib/test/test_sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,11 @@ def test_implementation(self):
self.assertEqual(sys.implementation.name,
sys.implementation.name.lower())

@test.support.cpython_only
def test_supports_isolated_interpreters(self):
Comment thread
sobolevn marked this conversation as resolved.
Resolved
# https://peps.python.org/pep-0734
self.assertIs(sys.implementation.supports_isolated_interpreters, True)

@test.support.cpython_only
def test_debugmallocstats(self):
# Test sys._debugmallocstats()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Added ``supports_isolated_interpreters`` field to
:data:`sys.implementation`.
5 changes: 5 additions & 0 deletions Python/sysmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3602,6 +3602,11 @@ make_impl_info(PyObject *version_info)
goto error;
#endif

res = PyDict_SetItemString(impl_info, "supports_isolated_interpreters",
Py_NewRef(Py_True)); // PEP-734
Comment thread
sobolevn marked this conversation as resolved.
Resolved
Comment thread
sobolevn marked this conversation as resolved.
Resolved
if (res < 0)
goto error;
Comment thread
sobolevn marked this conversation as resolved.
Resolved

/* dict ready */

ns = _PyNamespace_New(impl_info);
Expand Down