https://github.com/python/cpython/commit/08a467b537b3d9b499d060697e79b3950374ab0f
commit: 08a467b537b3d9b499d060697e79b3950374ab0f
branch: main
author: Jelle Zijlstra <[email protected]>
committer: JelleZijlstra <[email protected]>
date: 2024-09-26T06:26:03Z
summary:
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.
files:
M Doc/reference/datamodel.rst
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index a6348eda3891cc..5ce6bf17db41ea 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
---------------
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]