[issue27684] Incorrect exception message of ImportError constructor

Xiang Zhang report at bugs.python.org
Thu Aug 4 12:37:30 EDT 2016


New submission from Xiang Zhang:

ImportError accepts name and path as keyword-only parameters, but when invalid keyword argument passed, it emits wrong exception message saying that ImportError does not take keyword arguments.

>>> ImportError(name='name', path='path')
ImportError()
>>> ImportError(foo=1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: ImportError does not take keyword arguments

Propose a patch to fix this. Hope it helps.

----------
components: Interpreter Core
files: ImportError_constructor_exception.patch
keywords: patch
messages: 271991
nosy: brett.cannon, xiang.zhang
priority: normal
severity: normal
status: open
title: Incorrect exception message of ImportError constructor
versions: Python 3.6
Added file: http://bugs.python.org/file44009/ImportError_constructor_exception.patch

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


More information about the Python-bugs-list mailing list