[Python-checkins] bpo-32473: Improve ABCMeta._dump_registry() readability (GH-5091)

INADA Naoki webhook-mailer at python.org
Fri Jan 12 05:47:43 EST 2018


https://github.com/python/cpython/commit/a91662affeb0aae2515cdc5e8f82269337105bf4
commit: a91662affeb0aae2515cdc5e8f82269337105bf4
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: INADA Naoki <methane at users.noreply.github.com>
date: 2018-01-12T19:47:36+09:00
summary:

bpo-32473: Improve ABCMeta._dump_registry() readability (GH-5091)

(cherry picked from commit ae12f5d4c98f2095c2aadd58981453e955044697)

files:
A Misc/NEWS.d/next/Library/2018-01-10-20-37-59.bpo-32473.mP_yJG.rst
M Lib/abc.py

diff --git a/Lib/abc.py b/Lib/abc.py
index 43a34a0bbde..a092db2618a 100644
--- a/Lib/abc.py
+++ b/Lib/abc.py
@@ -170,9 +170,11 @@ def _dump_registry(cls, file=None):
         """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
index 00000000000..95b9d45e422
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-01-10-20-37-59.bpo-32473.mP_yJG.rst
@@ -0,0 +1 @@
+Improve ABCMeta._dump_registry() output readability



More information about the Python-checkins mailing list