[issue45540] module.__package__ and module.__spec__.parent have different semantics
Barry A. Warsaw
report at bugs.python.org
Wed Oct 20 13:11:23 EDT 2021
New submission from Barry A. Warsaw <barry at python.org>:
TL;DR module.__spec__.parent is read-only but module.__package__ is r/w despite documentation that implies that these two attributes should be identical, and various issues that focus on migrating from direct module attributes to ModuleSpec attributes.
bpo-33277 and bpo-21762
Maybe we should relax the restriction on module.__spec__.parent so that it's writeable just like module.__package__.
See also:
https://docs.python.org/3/reference/import.html?highlight=__loader__#package__
https://docs.python.org/3/library/types.html?highlight=__loader__#types.ModuleType.__package__
----------
components: Interpreter Core
messages: 404500
nosy: barry
priority: normal
severity: normal
status: open
title: module.__package__ and module.__spec__.parent have different semantics
versions: Python 3.11
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45540>
_______________________________________
More information about the Python-bugs-list
mailing list