diff options
author | Brett Cannon <brett@python.org> | 2014-03-14 13:46:28 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2014-03-14 13:46:28 (GMT) |
commit | f0b2ef150260972eaac683cecba8b02d568094ad (patch) | |
tree | 066f7e0b1563c61b730cd46de1e11721389b3e3f | |
parent | 698abe75d4e44dfecb8e6b8aa421b8505d24be05 (diff) | |
download | cpython-f0b2ef150260972eaac683cecba8b02d568094ad.zip cpython-f0b2ef150260972eaac683cecba8b02d568094ad.tar.gz cpython-f0b2ef150260972eaac683cecba8b02d568094ad.tar.bz2 |
Issue #20884: whatsnew: Frozen modules don't set __file__ anymore.
-rw-r--r-- | Doc/whatsnew/3.4.rst | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst index aedd6e2..b0ea9ac 100644 --- a/Doc/whatsnew/3.4.rst +++ b/Doc/whatsnew/3.4.rst @@ -2275,6 +2275,14 @@ Changes in the Python API to determine if a module is a package or not is to use``hasattr(module, '__path__')`` (:issue:`18065`). +* Frozen modules no longer define a ``__file__`` attribute. It's semantically + incorrect for frozen modules to set the attribute as they are not loaded from + any explicit location. If you must know that a module comes from frozen code + then you can see if the module's ``__spec__.location`` is set to ``'frozen'``, + check if the loader is a subclass of + :class:`importlib.machinery.FrozenImporter`, + or if Python 2 compatibility is necessary you can use :func:`imp.is_frozen`. + * :func:`py_compile.compile` now raises :exc:`FileExistsError` if the file path it would write to is a symlink or a non-regular file. This is to act as a warning that import will overwrite those files with a regular file regardless |