Skip to content

Commit d4cd390

Browse files
[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 08a467b)
1 parent 2b54a4e commit d4cd390

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Doc/reference/datamodel.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,8 +1048,10 @@ have the following two methods available:
10481048

10491049
.. doctest::
10501050

1051-
>>> int.__subclasses__()
1052-
[<class 'bool'>, <enum 'IntEnum'>, <flag 'IntFlag'>, <class 're._constants._NamedIntConstant'>]
1051+
>>> class A: pass
1052+
>>> class B(A): pass
1053+
>>> A.__subclasses__()
1054+
[<class 'B'>]
10531055

10541056
Class instances
10551057
---------------

0 commit comments

Comments
 (0)