classification
Title: Message can be formatted twice in importlib
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.6, Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: brett.cannon, eric.snow, ncoghlan, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2015-09-30 13:32 by serhiy.storchaka, last changed 2015-10-01 09:20 by serhiy.storchaka. This issue is now closed.

Files
File name Uploaded Description Edit
importlib_format_verbose_message.patch serhiy.storchaka, 2015-09-30 13:32 review
Messages (3)
msg251937 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-09-30 13:32
In importlib a verbose message can be formatted twice, the first time before passing it to _verbose_message(), and the second time in _verbose_message(), Example:

$ python -v
...
>>> open('{0}.pyc', 'wb').close()
>>> __import__('{0}')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 658, in exec_module
  File "<frozen importlib._bootstrap_external>", line 869, in get_code
  File "<frozen importlib._bootstrap_external>", line 440, in _validate_bytecode_header
  File "<frozen importlib._bootstrap_external>", line 368, in _verbose_message
IndexError: tuple index out of range

Proposed patch fixes the issue.
msg252009 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-10-01 08:57
New changeset da42b38f7470 by Serhiy Storchaka in branch '3.4':
Issue #25280: Import trace messages emitted in verbose (-v) mode are no
https://hg.python.org/cpython/rev/da42b38f7470

New changeset 10c13441bf8d by Serhiy Storchaka in branch '3.5':
Issue #25280: Import trace messages emitted in verbose (-v) mode are no
https://hg.python.org/cpython/rev/10c13441bf8d

New changeset e377d568928b by Serhiy Storchaka in branch 'default':
Issue #25280: Import trace messages emitted in verbose (-v) mode are no
https://hg.python.org/cpython/rev/e377d568928b
msg252011 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-10-01 09:20
Thank you Brett for your review.
History
Date User Action Args
2015-10-01 09:20:34serhiy.storchakasetstatus: open -> closed
messages: + msg252011

assignee: serhiy.storchaka
resolution: fixed
stage: patch review -> resolved
2015-10-01 08:57:07python-devsetnosy: + python-dev
messages: + msg252009
2015-09-30 13:32:17serhiy.storchakacreate