10000 [3.12] gh-101100: Make __subclasses__ doctest stable (GH-124577) by JelleZijlstra · Pull Request #124580 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.12] gh-101100: Make __subclasses__ doctest stable (GH-124577) #124580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
[3.12] 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>
  • Loading branch information
JelleZijlstra committed Sep 26, 2024
commit afc77b2958f6323e1f5dea6932eafdd3baf87e8b
6 changes: 4 additions & 2 deletions Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1048,8 +1048,10 @@ have the following two methods available:

.. doctest::

>>> int.__subclasses__()
[<class 'bool'>, <enum 'IntEnum'>, <flag 'IntFlag'>, <class 're._constants._NamedIntConstant'>]
>>> class A: pass
>>> class B(A): pass
>>> A.__subclasses__()
[<class 'B'>]

Class instances
---------------
Expand Down
Loading
0