STINNER Victor <vstin...@python.org> added the comment:

Serhiy: "You could save/restore this data only when corresponded modules was 
imported, like it was done in clear_caches() in refleak.py."

That's a very good idea! I implemented it in PR 24934. But I modified runtest() 
to use *two* saved_test_environment instance. One before the test module is 
imported, one after. The one before is needed to check if the import itself has 
side effect, for example if the module body has side effect. The second is to 
check if running tests has side effect. The second one is more likely to have 
modules imported. The first one may miss some bugs, but IMO it's an acceptable 
trade-off.

----------

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

Reply via email to