classification
Title: Incorrect exception message of ImportError constructor
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Misleading error message when ImportError called with invalid keyword args
View: 21578
Assigned To: Nosy List: berker.peksag, brett.cannon, xiang.zhang
Priority: normal Keywords: patch

Created on 2016-08-04 16:37 by xiang.zhang, last changed 2016-08-04 17:26 by berker.peksag. This issue is now closed.

Files
File name Uploaded Description Edit
ImportError_constructor_exception.patch xiang.zhang, 2016-08-04 16:37 review
Messages (2)
msg271991 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-08-04 16:37
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.
msg271993 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-08-04 17:26
This is a duplicate of issue 21578.
History
Date User Action Args
2016-08-04 17:26:40berker.peksagsetstatus: open -> closed

superseder: Misleading error message when ImportError called with invalid keyword args
nosy: + berker.peksag

messages: + msg271993
type: behavior
resolution: duplicate
stage: resolved
2016-08-04 16:37:30xiang.zhangcreate