[New-bugs-announce] [issue14646] Require loaders set __loader__ and __package__

Brett Cannon report at bugs.python.org
Sun Apr 22 21:37:53 CEST 2012

New submission from Brett Cannon <brett at python.org>:

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

assignee: brett.cannon
components: Interpreter Core
messages: 158983
nosy: brett.cannon
priority: release blocker
severity: normal
stage: test needed
status: open
title: Require loaders set __loader__ and __package__
type: behavior
versions: Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list