[issue33277] Deprecate __loader__, __package__, and __cached__ on modules
Barry A. Warsaw
report at bugs.python.org
Wed Oct 20 20:24:06 EDT 2021
Barry A. Warsaw <barry at python.org> added the comment:
On Oct 20, 2021, at 08:28, Eric Snow <report at bugs.python.org> wrote:
>
> The only catch I see is where the module's code sets one of the attrs. Would the proxy (or import machinery) pick those up, or maybe for some of them emit a warning or fail?
>
> We could also skip the proxy and add the properties to ModuleType directly, no?
My initial idea was to proxy from the ModuleType to the ModuleSpec and I started down that path, but hacking in C is much more painful than experimenting in Python, so that’s why I did my WIP branch (i.e. just to play with the feasibility of it).
Thus I had planned to keep the actual attribute values in the ModuleSpec and essentially implement a getattro and setattro in the ModuleType that proxied sets and gets to the ModuleSpec.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33277>
_______________________________________
More information about the Python-bugs-list
mailing list