classification
Title: None _frozen_importlib.__spec__.origin attribute
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.8, Python 3.7
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: nnja Nosy List: barry, brett.cannon, eric.snow, maggyero, mdk, ncoghlan, nnja
Priority: normal Keywords: patch

Created on 2018-11-26 23:19 by maggyero, last changed 2019-02-14 21:07 by maggyero. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 11732 merged nnja, 2019-02-02 01:54
Messages (8)
msg330479 - (view) Author: Géry (maggyero) * Date: 2018-11-26 23:19
How to reproduce:
In Python:
> import _frozen_importlib
> print(_frozen_importlib.__spec__.origin)

Observed result:
The __spec__.origin attribute of the _frozen_importlib module is None.

Expected result:
The __spec__.origin attribute of the _frozen_importlib module should be 'frozen', like it is already the case for the _frozen_importlib_external module and documented for all frozen modules in PEP 451: https://www.python.org/dev/peps/pep-0451/#origin
msg330558 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2018-11-27 23:30
I can replicate.

Do note, though, that PEPs are not documentation once they are implemented; at that point the official docs are what should be followed.
msg334005 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2019-01-18 19:16
Frozen module's origin isn't really documented AFAICT.  Here's the link to the library reference:

https://docs.python.org/3/library/importlib.html?highlight=origin#importlib.machinery.ModuleSpec.origin

The language reference doesn't really have anything to say here.  I think it wouldn't be difficult to add 'frozen' to the origin, but it should also be documented in the library reference (and of course, tested).
msg334006 - (view) Author: Nina Zakharenko (nnja) * (Python triager) Date: 2019-01-18 19:22
I'll be happy to take a look at this.
msg334007 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2019-01-18 19:22
I am mentoring Nina so I'll review this.
msg334852 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2019-02-05 00:56
New changeset 69091cb497b2f0fe7e2789b30b43cf78caf9de9b by Barry Warsaw (Nina Zakharenko) in branch 'master':
bpo-35321: Set the spec origin to frozen in frozen modules (#11732)
https://github.com/python/cpython/commit/69091cb497b2f0fe7e2789b30b43cf78caf9de9b
msg335561 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2019-02-14 20:49
Can this be closed?
msg335564 - (view) Author: Géry (maggyero) * Date: 2019-02-14 21:07
Yes, closed.
History
Date User Action Args
2019-02-14 21:07:38maggyerosetstatus: open -> closed

messages: + msg335564
stage: patch review -> resolved
2019-02-14 20:49:07brett.cannonsetmessages: + msg335561
2019-02-05 02:14:38ned.deilysetversions: - Python 3.6
2019-02-05 00:56:40barrysetmessages: + msg334852
2019-02-02 01:54:30nnjasetkeywords: + patch
stage: test needed -> patch review
pull_requests: + pull_request11629
2019-02-02 00:48:17barrysetversions: + Python 3.6
2019-01-18 19:22:38barrysetmessages: + msg334007
2019-01-18 19:22:22nnjasetmessages: + msg334006
2019-01-18 19:21:48nnjasetassignee: nnja

nosy: + nnja
2019-01-18 19:16:50barrysetversions: + Python 3.8
2019-01-18 19:16:36barrysetmessages: + msg334005
2018-11-27 23:30:59brett.cannonsetnosy: - docs@python
messages: + msg330558

components: + Interpreter Core, - Library (Lib)
type: behavior
stage: test needed
2018-11-26 23:19:31maggyerocreate