Skip to content

Commit ae12f5d

Browse files
yahya-abou-imranmethane
authored andcommitted
bpo-32473: Improve ABCMeta._dump_registry() readability (GH-5091)
1 parent 05565ed commit ae12f5d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Lib/abc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,11 @@ def _dump_registry(cls, file=None):
170170
"""Debug helper to print the ABC registry."""
171171
print("Class: %s.%s" % (cls.__module__, cls.__qualname__), file=file)
172172
print("Inv.counter: %s" % ABCMeta._abc_invalidation_counter, file=file)
173-
for name in sorted(cls.__dict__.keys()):
173+
for name in cls.__dict__:
174174
if name.startswith("_abc_"):
175175
value = getattr(cls, name)
176+
if isinstance(value, WeakSet):
177+
value = set(value)
176178
print("%s: %r" % (name, value), file=file)
177179

178180
def __instancecheck__(cls, instance):
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improve ABCMeta._dump_registry() output readability

0 commit comments

Comments
 (0)