Serhiy Storchaka added the comment:

Here is a patch with smaller (in comparison with issue27358) change for 3.5 
that improves error message when pass a non-mapping as second var-keyword 
argument.

Unpatched:

>>> f(**{'a': 1}, **[])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'list' object is not a mapping
>>> f(**{'a': 1}, **0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'int' object is not iterable

Patched:

>>> f(**{'a': 1}, **[])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: f() argument after ** must be a mapping, not list
>>> f(**{'a': 1}, **0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: f() argument after ** must be a mapping, not int

----------
assignee:  -> serhiy.storchaka
priority: deferred blocker -> normal
versions: +Python 3.5 -Python 3.6, Python 3.7
Added file: 
http://bugs.python.org/file44924/build-map-unpack-with-call-error-messages-3.5.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28257>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to