New submission from Eric Snow: The first thing that importlib.reload() does is to verify that the passed module is an instance of types.ModuleType (Lib/importlib/__init__.py:107). This check seems unnecessary to me. We really don't have a functional need for the check (that I know of). Furthermore, there has been at least one serious proposal recently that suggested using custom module types.
The only benefit that I can think of to the type check is it makes the failure more clear when someone tries to "reload" an attribute in a module (thinking just the attribute will get reloaded!). However, does that matter all that much now that reload() is not a builtin (ergo less likely to get misused very often)? I'm not invested in removing these 2 lines (or at least loosening the restriction). I've brought it up simply because it keeps staring me in the face lately. :-) If anyone has any objections, I'll drop it (at least it will be recorded here in the tracker). That said, I'm glad to remove the restriction otherwise. ---------- components: Library (Lib) messages: 201874 nosy: brett.cannon, eric.snow, ncoghlan priority: normal severity: normal stage: needs patch status: open title: Relax the type restriction on reloaded modules type: enhancement versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19468> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com