Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

My initial idea was to add a lightweight module cachesreg with two functions: 
register() and clear_caches(). PR 12639 implements it.

But I like Brett's idea more, because it is simpler. The only disadvantage of 
it is that if you make a typo in __clearcache__, this function will be silently 
ignored.

I thought also about different levels of cachesreg.cachesreg.register() could 
take two arguments -- the level and the clearing function. Then 
cachesreg.clear_caches() could allow to clear only caches of specified level 
and smaller/larger.

Both PRs add clearing callbacks only for modules which already cleared in 
regrtests. There are more caches, and with implementing any of these ideas it 
will be easier to add clearing caches in other modules.

----------

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

Reply via email to