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()