Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 787794f

Browse files
committed
Fix _dump_registry() to use the correct prefix for the private
methods. Reset the negative cache *before* resetting the invalidation counter, hoping this may plug a race condition (but then again, this whole module isn't coded to be thread-safe).
1 parent ba9c9ac commit 787794f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/abc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def _dump_registry(cls, file=None):
157157
print("Class: %s.%s" % (cls.__module__, cls.__name__), file=file)
158158
print("Inv.counter: %s" % ABCMeta.__invalidation_counter, file=file)
159159
for name in sorted(cls.__dict__.keys()):
160-
if name.startswith("__abc_"):
160+
if name.startswith("_ABCMeta__"):
161161
value = getattr(cls, name)
162162
print("%s: %r" % (name, value), file=file)
163163

@@ -174,8 +174,8 @@ def __subclasscheck__(cls, subclass):
174174
# Check negative cache; may have to invalidate
175175
if cls.__negative_cache_version < ABCMeta.__invalidation_counter:
176176
# Invalidate the negative cache
177-
cls.__negative_cache_version = ABCMeta.__invalidation_counter
178177
cls.__negative_cache = set()
178+
cls.__negative_cache_version = ABCMeta.__invalidation_counter
179179
elif subclass in cls.__negative_cache:
180180
return False
181181
# Check the subclass hook

0 commit comments

Comments
 (0)