[issue25280] Message can be formatted twice in importlib

Serhiy Storchaka report at bugs.python.org
Wed Sep 30 15:32:18 CEST 2015


New submission from Serhiy Storchaka:

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.

----------
components: Library (Lib)
files: importlib_format_verbose_message.patch
keywords: patch
messages: 251937
nosy: brett.cannon, eric.snow, ncoghlan, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Message can be formatted twice in importlib
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file40626/importlib_format_verbose_message.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25280>
_______________________________________


More information about the Python-bugs-list mailing list