New submission from Nick Coghlan:

ABCMeta uses an internal counter to invalidate the negative caches when a 
register() call changes the virtual inheritance graph. (A global count of 
register() calls is stored on ABCMeta, which ABCMeta.__instancecheck__ and 
ABCMeta.__subclasscheck__ then compare to a copy cached on the individual ABC)

To properly handle register() method calls on ABCs, generic function 
implementations also need a way to invalidate their own caches when that graph 
changes.

It seems like the simplest way to handle this would be to expose a read-only 
"ABCMeta.cache_token" property. Generic function implementations could then 
work the same way as ABCMeta itself: store explicit implementation 
registrations and a cache of derived implementations separately, and if a saved 
copy of the cache token doesn't match the current value of ABCMeta.cache_token, 
clear the derived cache.

----------
components: Library (Lib)
messages: 178725
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Expose cache validity checking support in ABCMeta
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16832>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to