Author serhiy.storchaka
Recipients brett.cannon, ezio.melotti, malin, michael.foord, rhettinger, serhiy.storchaka
Date 2019-03-31.09:11:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1554023492.46.0.405168731244.issue36485@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-03-31 09:11:32serhiy.storchakasetrecipients: + serhiy.storchaka, brett.cannon, rhettinger, ezio.melotti, michael.foord, malin
2019-03-31 09:11:32serhiy.storchakasetmessageid: <1554023492.46.0.405168731244.issue36485@roundup.psfhosted.org>
2019-03-31 09:11:32serhiy.storchakalinkissue36485 messages
2019-03-31 09:11:32serhiy.storchakacreate