From: Jelle Zijlstra Date: Thu, 26 Sep 2024 06:40:40 +0000 (-0700) Subject: [3.12] gh-101100: Make __subclasses__ doctest stable (GH-124577) (#124580) X-Git-Tag: v3.12.7~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d4cd39097e82b2cd8842e1e3f75662ac4b0610bd;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-101100: Make __subclasses__ doctest stable (GH-124577) (#124580) Using a standard library class makes this test difficult to maintain as other tests and other parts of the stdlib may create subclasses, which may still be alive when this test runs depending on GC timing. (cherry picked from commit 08a467b537b3d9b499d060697e79b3950374ab0f) --- diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 5dcdb7bd8dd4..d1993fedb0ca 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1048,8 +1048,10 @@ have the following two methods available: .. doctest:: - >>> int.__subclasses__() - [, , , ] + >>> class A: pass + >>> class B(A): pass + >>> A.__subclasses__() + [] Class instances ---------------