summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2024-10-23 16:10:06 (GMT)
committerGitHub <noreply@github.com>2024-10-23 16:10:06 (GMT)
commit6f26d496d3c894970ee18a125e9100791ebc2b36 (patch)
tree62999ec30e17bb0334c82ae7137b10a6d64f3e48 /Doc
parentde0d5c6e2e12f24ade1ccc457afaf5fb2c650c64 (diff)
downloadcpython-6f26d496d3c894970ee18a125e9100791ebc2b36.zip
cpython-6f26d496d3c894970ee18a125e9100791ebc2b36.tar.gz
cpython-6f26d496d3c894970ee18a125e9100791ebc2b36.tar.bz2
gh-125286: Share the Main Refchain With Legacy Interpreters (gh-125709)
They used to be shared, before 3.12. Returning to sharing them resolves a failure on Py_TRACE_REFS builds. Co-authored-by: Petr Viktorin <encukou@gmail.com>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/sys.rst29
-rw-r--r--Doc/using/configure.rst2
-rw-r--r--Doc/whatsnew/3.14.rst9
3 files changed, 39 insertions, 1 deletions
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index 20a06a1..37f1719 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -920,6 +920,35 @@ always available.
It is not guaranteed to exist in all implementations of Python.
+.. function:: getobjects(limit[, type])
+
+ This function only exists if CPython was built using the
+ specialized configure option :option:`--with-trace-refs`.
+ It is intended only for debugging garbage-collection issues.
+
+ Return a list of up to *limit* dynamically allocated Python objects.
+ If *type* is given, only objects of that exact type (not subtypes)
+ are included.
+
+ Objects from the list are not safe to use.
+ Specifically, the result will include objects from all interpreters that
+ share their object allocator state (that is, ones created with
+ :c:member:`PyInterpreterConfig.use_main_obmalloc` set to 1
+ or using :c:func:`Py_NewInterpreter`, and the
+ :ref:`main interpreter <sub-interpreter-support>`).
+ Mixing objects from different interpreters may lead to crashes
+ or other unexpected behavior.
+
+ .. impl-detail::
+
+ This function should be used for specialized purposes only.
+ It is not guaranteed to exist in all implementations of Python.
+
+ .. versionchanged:: next
+
+ The result may include objects from other interpreters.
+
+
.. function:: getprofile()
.. index::
diff --git a/Doc/using/configure.rst b/Doc/using/configure.rst
index 10cdf23..0e7b1be 100644
--- a/Doc/using/configure.rst
+++ b/Doc/using/configure.rst
@@ -702,7 +702,7 @@ Debug options
Effects:
* Define the ``Py_TRACE_REFS`` macro.
- * Add :func:`!sys.getobjects` function.
+ * Add :func:`sys.getobjects` function.
* Add :envvar:`PYTHONDUMPREFS` environment variable.
The :envvar:`PYTHONDUMPREFS` environment variable can be used to dump
diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst
index b389e6d..64f3d18 100644
--- a/Doc/whatsnew/3.14.rst
+++ b/Doc/whatsnew/3.14.rst
@@ -416,6 +416,15 @@ symtable
(Contributed by Bénédikt Tran in :gh:`120029`.)
+
+sys
+---
+
+* The previously undocumented special function :func:`sys.getobjects`,
+ which only exists in specialized builds of Python, may now return objects
+ from other interpreters than the one it's called in.
+
+
unicodedata
-----------