summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2024-09-26 06:26:03 (GMT)
committerGitHub <noreply@github.com>2024-09-26 06:26:03 (GMT)
commit08a467b537b3d9b499d060697e79b3950374ab0f (patch)
tree0cfd40c763c44ab349ca0aebf729c4e489abc5e2
parent1229cb8c1412d37cf3206eab407f03e21d602cbd (diff)
downloadcpython-08a467b537b3d9b499d060697e79b3950374ab0f.zip
cpython-08a467b537b3d9b499d060697e79b3950374ab0f.tar.gz
cpython-08a467b537b3d9b499d060697e79b3950374ab0f.tar.bz2
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.
-rw-r--r--Doc/reference/datamodel.rst6
1 files changed, 4 insertions, 2 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index a6348ed..5ce6bf1 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -1109,8 +1109,10 @@ have the following two methods available:
.. doctest::
- >>> int.__subclasses__()
- [<class 'bool'>, <enum 'IntEnum'>, <flag 'IntFlag'>, <class 're._constants._NamedIntConstant'>, <class 're._ZeroSentinel'>]
+ >>> class A: pass
+ >>> class B(A): pass
+ >>> A.__subclasses__()
+ [<class 'B'>]
Class instances
---------------