Skip to content

Commit 08a467b

Browse files
gh-101100: Make __subclasses__ doctest stable (#124577)
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.
1 parent 1229cb8 commit 08a467b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Doc/reference/datamodel.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -1109,8 +1109,10 @@ have the following two methods available:
11091109

11101110
.. doctest::
11111111

1112-
>>> int.__subclasses__()
1113-
[<class 'bool'>, <enum 'IntEnum'>, <flag 'IntFlag'>, <class 're._constants._NamedIntConstant'>, <class 're._ZeroSentinel'>]
1112+
>>> class A: pass
1113+
>>> class B(A): pass
1114+
>>> A.__subclasses__()
1115+
[<class 'B'>]
11141116

11151117
Class instances
11161118
---------------

0 commit comments

Comments
 (0)