Re: direct access of import state (e.g. modules replacing themselves in sys.modules)
Nick Coghlan <[email protected]> Tue, 31 May 2016 13:16:03 +1000
| Newsgroups | gmane.comp.python.import |
|---|---|
| Message-ID | <CADiSq7dbbyTh7aw+cAwA1gYnxZTYtY0nrAgu2eNvFgd=4VMxOQ@mail.gmail.com> |
--===============4908740210144044870== Content-Type: multipart/alternative; boundary=001a1141611814119205341acbb8 --001a1141611814119205341acbb8 Content-Type: text/plain; charset=UTF-8 On 29 May 2016 3:10 pm, "Eric Snow" <[email protected]> wrote: > > Looking through all the code, I don't think it's worth it (for now) to > worry about using an import "system" that isn't hooked up to the > import state in sys. I'll still look into a more isolated import > "system" abstraction later through. :) That's basically why PEP 406 stalled - the associated GSoC project showed that the problem was more complex than I first thought (due to separate problems with passing state to import statements in the imported code and the process global nature of extension module loading). It's also worth keeping in mind that many of the recent changes to better support advanced use cases like lazy module loading and letting Cython better emulate pure Python import semantics are already still deeply mystifying to folks with more prosaic needs like "given a path, import that file as a module": http://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path Cheers, Nick. --001a1141611814119205341acbb8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <p dir=3D"ltr"><br> On 29 May 2016 3:10 pm, "Eric Snow" <<a href=3D"mailto:ericsno= [email protected]">[email protected]</a>> wrote:<br> ><br> > Looking through all the code, I don't think it's worth it (for= now) to<br> > worry about using an import "system" that isn't hooked u= p to the<br> > import state in sys.=C2=A0 I'll still look into a more isolated im= port<br> > "system" abstraction later through. :)</p> <p dir=3D"ltr">That's basically why PEP 406 stalled - the associated GS= oC project showed that the problem was more complex than I first thought (d= ue to separate problems with passing state to import statements in the impo= rted code and the process global nature of extension module loading).</p> <p dir=3D"ltr">It's also worth keeping in mind that many of the recent = changes to better support advanced use cases like lazy module loading and l= etting Cython better emulate pure Python import semantics are already still= deeply mystifying to folks with more prosaic needs like "given a path= , import that file as a module": <a href=3D"http://stackoverflow.com/q= uestions/67631/how-to-import-a-module-given-the-full-path">http://stackover= flow.com/questions/67631/how-to-import-a-module-given-the-full-path</a></p> <p dir=3D"ltr">Cheers,<br> Nick.<br> </p> --001a1141611814119205341acbb8-- --===============4908740210144044870== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Import-SIG mailing list [email protected] https://mail.python.org/mailman/listinfo/import-sig --===============4908740210144044870==--