Author serhiy.storchaka
Recipients brett.cannon, ezio.melotti, michael.foord, serhiy.storchaka
Date 2019-03-30.11:56:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Some modules have caches. There is a need to clear all tests before running tests. Brett proposed to add in all modules with caches a function with the standardized name which is responsible for clearing module related caches. [1]

The proposed PR adds a new function clear_caches() in the sys module. It iterates all imported modules and calls function __clearcache__() if it is defined.

    def clear_caches():
        for mod in reversed(list(sys.modules.values())):
            if hasattr(mod, '__clearcache__'):

clear_caches() will be used in test.regrtest and can be used in user code. The PR defines also function __clearcache__ for modules which are cleared manually in the current code.

This is a preliminary implementation, bikeshedding is welcome.

Date User Action Args
2019-03-30 11:56:59serhiy.storchakasetrecipients: + serhiy.storchaka, brett.cannon, ezio.melotti, michael.foord
2019-03-30 11:56:59serhiy.storchakasetmessageid: <>
2019-03-30 11:56:59serhiy.storchakalinkissue36485 messages
2019-03-30 11:56:59serhiy.storchakacreate