]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-101100: Make __subclasses__ doctest stable (GH-124577) (#124580)
authorJelle Zijlstra <jelle.zijlstra@gmail.com>
Thu, 26 Sep 2024 06:40:40 +0000 (23:40 -0700)
committerGitHub <noreply@github.com>
Thu, 26 Sep 2024 06:40:40 +0000 (06:40 +0000)
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)

Doc/reference/datamodel.rst

index 5dcdb7bd8dd414968aad08d3d9fa7e3d5efb3948..d1993fedb0ca44b5331330023f7155423f56010e 100644 (file)
@@ -1048,8 +1048,10 @@ have the following two methods available:
 
    .. doctest::
 
-      >>> int.__subclasses__()
-      [<class 'bool'>, <enum 'IntEnum'>, <flag 'IntFlag'>, <class 're._constants._NamedIntConstant'>]
+      >>> class A: pass
+      >>> class B(A): pass
+      >>> A.__subclasses__()
+      [<class 'B'>]
 
 Class instances
 ---------------