[Python-Dev] __file__

Tres Seaver tseaver at palladion.com
Sat Feb 27 18:03:18 CET 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ian Bicking wrote:
> The one issue I thought would be resolved by not easily allowing
> .pyc-only distributions is the case when you rename a file (say
> module.py to newmodule.py) and there is a module.pyc laying around,
> and you don't get the ImportError you would expect from "import
> module" -- and to make it worse everything basically works, except
> there's two versions of the module that slowly become different.  This
> regularly causes problems for me, and those problems would get more
> common and obscure if the pyc files were stashed away in a more
> invisible location.
> 
> I can't even tell what the current proposal is; maybe this is
> resolved?  If distributing bytecode required renaming pyc files to .py
> as Glenn suggested that would resolve the problem quite nicely from my
> perspective.  (Frankly I find the whole use case for distributing
> bytecodes a bit specious, but whatever.)

The consensus as I recal was that a .pyc file in the main package
directory would be importable without a .py file (just as it is today),
but that .pyc files in the cache directory would not be importable in
the absence of a .py file.  Package distributors who wanted to ship
bytecode-only distributions would need to arrange to have the .pyc files
created "in place' (by disabling the cachedir option) or move them from
the cachedir before bundling.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkuJUFIACgkQ+gerLs4ltQ6pnwCfVmDO8uiP9eSsjJf4ees35xus
SEUAn0oKJwv9bGksxcMTHSfBbDV2Ujb7
=Vdpi
-----END PGP SIGNATURE-----



More information about the Python-Dev mailing list