bpo-36016: Add generation option to gc.getobjects() (GH-11909)
diff --git a/Doc/library/gc.rst b/Doc/library/gc.rst
index 722a0e8..084cd6a 100644
--- a/Doc/library/gc.rst
+++ b/Doc/library/gc.rst
@@ -63,11 +63,14 @@
Return the debugging flags currently set.
-.. function:: get_objects()
+.. function:: get_objects(generation=None)
Returns a list of all objects tracked by the collector, excluding the list
- returned.
+ returned. If *generation* is not None, return only the objects tracked by
+ the collector that are in that generation.
+ .. versionchanged:: 3.8
+ New *generation* parameter.
.. function:: get_stats()
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index bf7300d..a531d2d 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -163,6 +163,15 @@
Added :func:`~gettext.pgettext` and its variants.
(Contributed by Franz Glasner, Éric Araujo, and Cheryl Sabella in :issue:`2504`.)
+
+gc
+--
+
+:func:`~gc.get_objects` can now receive an optional *generation* parameter
+indicating a generation to get objects from. Contributed in
+:issue:`36016` by Pablo Galindo.
+
+
gzip
----