]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-32473: Improve ABCMeta._dump_registry() readability (GH-5091)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 12 Jan 2018 10:47:36 +0000 (02:47 -0800)
committerINADA Naoki <methane@users.noreply.github.com>
Fri, 12 Jan 2018 10:47:36 +0000 (19:47 +0900)
(cherry picked from commit ae12f5d4c98f2095c2aadd58981453e955044697)

Lib/abc.py
Misc/NEWS.d/next/Library/2018-01-10-20-37-59.bpo-32473.mP_yJG.rst [new file with mode: 0644]

index 43a34a0bbded7864987f57a855bf788c4b74138f..a092db2618ac822331711fc16c1ef2469a1428cd 100644 (file)
@@ -170,9 +170,11 @@ class ABCMeta(type):
         """Debug helper to print the ABC registry."""
         print("Class: %s.%s" % (cls.__module__, cls.__qualname__), file=file)
         print("Inv.counter: %s" % ABCMeta._abc_invalidation_counter, file=file)
-        for name in sorted(cls.__dict__.keys()):
+        for name in sorted(cls.__dict__):
             if name.startswith("_abc_"):
                 value = getattr(cls, name)
+                if isinstance(value, WeakSet):
+                    value = set(value)
                 print("%s: %r" % (name, value), file=file)
 
     def __instancecheck__(cls, instance):
diff --git a/Misc/NEWS.d/next/Library/2018-01-10-20-37-59.bpo-32473.mP_yJG.rst b/Misc/NEWS.d/next/Library/2018-01-10-20-37-59.bpo-32473.mP_yJG.rst
new file mode 100644 (file)
index 0000000..95b9d45
--- /dev/null
@@ -0,0 +1 @@
+Improve ABCMeta._dump_registry() output readability