[Python-Dev] Python 3.4 change in importlib/init.py breaking cxFreeze? (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Mon Mar 10 22:15:08 CET 2014


On 11 Mar 2014 01:44, "Brett Cannon" <bcannon at gmail.com> wrote:

_On Mon Mar 10 2014 at 11:41:27 AM, Jurko Gospodnetić <_ jurko.gospodnetic at pke.hr> wrote: Hi Nick. On 10.3.2014. 14:25, Nick Coghlan wrote:> What is supposed to happen when that code gets loaded from a ZIP archive? > > file is expected to always be set (including when loaded from a > zipfile - in that case it's the zipfile name concatenated with the > path within the zip file). If it isn't set, there's a buggy loader > involved somewhere that isn't setting it properly. I don't recall seeing that ever explicitly stated. For that matter, Python 3.4.0rc3 documentation explicitly states: > file is optional. If set, this attribute’s value must be a string. > The import system may opt to leave file unset if it has no > semantic meaning (e.g. a module loaded from a database). and: > Ultimately, the loader is what makes use of file and/or cached. Or is this some rule specific to the importlib/init.py stdlib module? No, Nick was mistaken and Barry's response is accurate: file is optional and left off when it doesn't make any sense. Since importlib._bootstrap is a frozen module by default it doesn't have file set.

Yeah, I was thinking of the 3.4 changes to ensure that various other module attributes are always set, even in main (and frozen modules).

My apologies for the misinformation - I should have waited until I had a chance to look it up properly.

Cheers, Nick.

-Brett

As I recall, I first learned that not all loaded modules need to have their file attribute set by researching a failure in some package when installed as a zipped-egg using setuptools. Admittedly though, that was some old setuptools version. Best regards, Jurko Gospodnetić


Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/brett%40python.org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20140311/05dd0e89/attachment-0001.html>



More information about the Python-Dev mailing list