modutil
modutil copied to clipboard
Proxy module attributes through to __spec__
I.e. remove __file__, __cached__, __package__, and __loader__ from a module and proxy their accesses through to the underlying __spec__ object. Provides another way to minimize the attributes exposed on a module.
Deleting __name__ and __path__ is probably a bad idea since too much code out there assuming those attributes are set at the global level of a module.