Issue 14646: Require loaders set loader and package (original) (raw)

Issue14646

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/58851

classification

Title: Require loaders set __loader__ and __package__
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.3

process

Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: Arfrever, brett.cannon, eric.snow, georg.brandl, python-dev
Priority: release blocker Keywords:

Created on 2012-04-22 19:37 by brett.cannon, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg158983 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2012-04-22 19:37
As discussed and agreed to on python-dev, it makes sense to require loaders to set __loader__ and __package__ so that they can be relied upon by globally executed code in a module. The following needs to happen to close this bug: * Update PEP 302 to say __loader__ is required, not optional * Update PEP 366 to say __package__ is required * Update PEP 302 to point to PEP 366 and mention the requirement * Update importlib.util.module_for_loader to set both __loader__ and __package__ * Update importlib.util.set_loader and importlib.util.set_package to point out that module_for_loader supercedes those decorators * Update importlib._bootstrap to set __loader__ when it is absent
msg158984 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2012-04-22 19:51
Yeah, that patch for reload() in relies on this.
msg159495 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-04-27 21:33
New changeset 496c68f90a03 by Brett Cannon in branch 'default': Issue #14646: __import__() now sets __loader__ if need be. http://hg.python.org/cpython/rev/496c68f90a03
History
Date User Action Args
2022-04-11 14:57:29 admin set nosy: + georg.brandlgithub: 58851
2012-04-27 21:42:35 brett.cannon set status: open -> closedresolution: fixedstage: test needed -> resolved
2012-04-27 21:33:07 python-dev set nosy: + python-devmessages: +
2012-04-22 20:23:57 Arfrever set nosy: + Arfrever
2012-04-22 19:51:48 eric.snow set nosy: + eric.snowmessages: +
2012-04-22 19:37:53 brett.cannon create

Supported by The Python Software Foundation,
Powered by Roundup

Copyright © 1990-2022, Python Software Foundation
Legal Statements