On Fri, Oct 25, 2013 at 10:24 AM, PJ Eby <p...@telecommunity.com> wrote: > I've not really had time to review this PEP yet, but from skimming > discussion to date, the only thing I'm still worried about is whether > this will break lazy import schemes that use a module subclass that > hooks __getattribute__ and calls reload() in order to perform what's > actually an *initial* load. > > IOW, does anything in this proposal rely on a module object having > *any* attributes besides __name__ set at reload() time? That is, is > there an assumption that a module being reloaded has > > 1. Been loaded, and > 2. Is being reloaded via the same location, __loader__, etc. as before? > > At least through all 2.x, reload() just uses module.__name__ to > restart the module find-and-load process, and does not assume that > __loader__ is valid in advance. > > (Also, if this has changed in recent Python versions independent of > this PEP, it's a backwards-compatibility break that should be > documented somewhere.)
Yeah, this actually changed in 3.3 IIRC, where reload now calls module.__loader__.load_module(module.__name__). I'll double-check. PEP 451 simply changes that to be (basically) module.__loader__.exec_module(module). -eric _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com