Skip to content

Document __spec__.location 'frozen' value#18686

Closed
Cheaterman wants to merge 1 commit intopython:masterfrom
Cheaterman:patch-1
Closed

Document __spec__.location 'frozen' value#18686
Cheaterman wants to merge 1 commit intopython:masterfrom
Cheaterman:patch-1

Conversation

@Cheaterman
Copy link
Copy Markdown

@Cheaterman Cheaterman commented Feb 28, 2020

As noted in https://docs.python.org/3/whatsnew/3.4.html :
« 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
importlib.machinery.FrozenImporter, or if Python 2
compatibility is necessary you can use imp.is_frozen(). »

As noted in https://docs.python.org/3/whatsnew/3.4.html :
« 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
importlib.machinery.FrozenImporter, or if Python 2
compatibility is necessary you can use imp.is_frozen(). »
@the-knights-who-say-ni
Copy link
Copy Markdown

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

Recognized GitHub username

We couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames:

@Cheaterman

This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@Cheaterman
Copy link
Copy Markdown
Author

CLA signed by the way :-)

@Cheaterman
Copy link
Copy Markdown
Author

Should I maybe create an issue on bugs.python.org ?

@brettcannon
Copy link
Copy Markdown
Member

@Cheaterman nope, a bug report isn't necessary for a doc fix like this.

@brettcannon
Copy link
Copy Markdown
Member

@warsaw @ericsnowcurrently @ncoghlan @encukou what do you all think of updating the language reference to say that __spec__.origin will say "frozen" for frozen modules? Is it worth having that strong of a guarantee? Or just document it in the importlib docs?

@ericsnowcurrently
Copy link
Copy Markdown
Member

Frozen modules are a CPython-specific feature, no?

@brettcannon
Copy link
Copy Markdown
Member

@ericsnowcurrently yep

@brettcannon
Copy link
Copy Markdown
Member

Based on the fact that frozen modules are specific to CPython and not the language, I'm going to close this. Thanks for the PR regardless, @Cheaterman !

@Cheaterman Cheaterman deleted the patch-1 branch March 27, 2020 09:37
@Cheaterman
Copy link
Copy Markdown
Author

Cheaterman commented Mar 27, 2020 via email

@altendky
Copy link
Copy Markdown
Contributor

Where does this information belong? If the issue is that it is CPython specific then wouldn't that just warrant a disclaimer explaining such? Also, FrozenImporter is documented without any 'this is a CPython implementation detail' note.

@brettcannon
Copy link
Copy Markdown
Member

@altendky the importlib docs is a relevant place for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants