classification
Title: Writable __spec__.has_location attribute
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: barry, brett.cannon, docs@python, eric.snow, maggyero, mdk, ncoghlan, xtreak
Priority: normal Keywords:

Created on 2018-11-26 23:00 by maggyero, last changed 2018-11-27 23:32 by brett.cannon. This issue is now closed.

Messages (3)
msg330474 - (view) Author: Géry (maggyero) * Date: 2018-11-26 23:00
How to reproduce:
Assign the __spec__.has_location attribute of any module.

Observed result:
__spec__.has_location is a writable.

Expected result:
__spec__.has_location should be read-only, as defined in PEP 451: https://www.python.org/dev/peps/pep-0451/#attributes
msg330492 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-11-27 06:54
I think a setter was added for has_location (msg205384) and docs were updated as part of the patch but the PEP was not updated? . A setter for has_location : https://hg.python.org/cpython/rev/e961a166dc70
msg330559 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2018-11-27 23:32
The docs do not specify that has_location is read-only: https://docs.python.org/3/library/importlib.html#importlib.machinery.ModuleSpec.has_location .

And PEPs are not updated once they are implemented as that would mean we would have to perpetually update docs in at least two different places.
History
Date User Action Args
2018-11-27 23:32:49brett.cannonsetstatus: open -> closed
resolution: out of date
messages: + msg330559

stage: resolved
2018-11-27 06:54:08xtreaksetmessages: + msg330492
2018-11-27 06:10:06xtreaksetnosy: + xtreak
2018-11-26 23:20:11maggyerosetnosy: + maggyero
2018-11-26 23:18:26maggyerosetnosy: - maggyero
2018-11-26 23:00:16maggyerocreate