8000 [3.13] gh-101100: Make __subclasses__ doctest stable (GH-124577) (#12… · python/cpython@a079922 · GitHub
[go: up one dir, main page]

Skip to content

Commit a079922

Browse files
[3.13] gh-101100: Make __subclasses__ doctest stable (GH-124577) (#124579)
gh-101100: Make __subclasses__ doctest stable (GH-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. (cherry picked from commit 08a467b) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
1 parent 410e0ef commit a079922

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
@@ -1053,8 +1053,10 @@ have the following two methods available:
10531053

10541054
.. doctest::
10551055

1056-
>>> int.__subclasses__()
1057-
[<class 'bool'>, <enum 'IntEnum'>, <flag 'IntFlag'>, <class 're._constants._NamedIntConstant'>, <class 're._ZeroSentinel'>]
1056+
>>> class A: pass
1057+
>>> class B(A): pass
1058+
>>> A.__subclasses__()
1059+
[<class 'B'>]
10581060

10591061
Class instances
10601062
---------------

0 commit comments

Comments
 (0)
0