10000 bpo-37645: add new function _PyObject_FunctionStr() by jdemeyer · Pull Request #14890 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-37645: add new function _PyObject_FunctionStr() #14890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 5, 2019
Prev Previous commit
Next Next commit
Change format_kwargs_error to use _PyObject_FunctionStr as well
  • Loading branch information
encukou committed Nov 5, 2019
commit 402ec96210412af6442544c3f954e3d0532519c8
26 changes: 13 additions & 13 deletions Lib/test/test_extcall.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@
>>> f(1, 2, **{'a': -1, 'b': 5}, **{'a': 4, 'c': 6})
Traceback (most recent call last):
...
TypeError: f() got multiple values for keyword argument 'a'
TypeError: test.test_extcall.f() got multiple values for keyword argument 'a'
>>> f(1, 2, **{'a': -1, 'b': 5}, a=4, c=6)
Traceback (most recent call last):
...
TypeError: f() got multiple values for keyword argument 'a'
TypeError: test.test_extcall.f() got multiple values for keyword argument 'a'
>>> f(1, 2, a=3, **{'a': 4}, **{'a': 5})
Traceback (most recent call last):
...
TypeError: f() got multiple values for keyword argument 'a'
TypeError: test.test_extcall.f() got multiple values for keyword argument 'a'
>>> f(1, 2, 3, *[4, 5], **{'a':6, 'b':7})
(1, 2, 3, 4, 5) {'a': 6, 'b': 7}
>>> f(1, 2, 3, x=4, y=5, *(6, 7), **{'a':8, 'b': 9})
Expand Down Expand Up @@ -274,32 +274,32 @@
>>> h(**h)
Traceback (most recent call last):
...
TypeError: h() argument after ** must be a mapping, not function
TypeError: test.test_extcall.h() argument after ** must be a mapping, not function

>>> h(**[])
Traceback (most recent call last):
...
TypeError: h() argument after ** must be a mapping, not list
TypeError: test.test_extcall.h() argument after ** must be a mapping, not list

>>> h(a=1, **h)
Traceback (most recent call last):
...
TypeError: h() argument after ** must be a mapping, not function
TypeError: test.test_extcall.h() argument after ** must be a mapping, not function

>>> h(a=1, **[])
Traceback (most recent call last):
...
TypeError: h() argument after ** must be a mapping, not list
TypeError: test.test_extcall.h() argument after ** must be a mapping, not list

>>> h(**{'a': 1}, **h)
Traceback (most recent call last):
...
TypeError: h() argument after ** must be a mapping, not function
TypeError: test.test_extcall.h() argument after ** must be a mapping, not function

>>> h(**{'a': 1}, **[])
Traceback (most recent call last):
...
TypeError: h() argument after ** must be a mapping, not list
TypeError: test.test_extcall.h() argument after ** must be a mapping, not list

>>> dir(**h)
Traceback (most recent call last):
Expand All @@ -309,7 +309,7 @@
>>> nothing(**h)
Traceback (most recent call last):
...
TypeError: NoneType object argument after ** must be a mapping, \
TypeError: None argument after ** must be a mapping, \
not function

>>> dir(b=1, **{'b': 1})
Expand Down Expand Up @@ -351,17 +351,17 @@
>>> g(**MultiDict([('x', 1), ('x', 2)]))
Traceback (most recent call last):
...
TypeError: g() got multiple values for keyword argument 'x'
TypeError: test.test_extcall.g() got multiple values for keyword argument 'x'

>>> g(a=3, **MultiDict([('x', 1), ('x', 2)]))
Traceback (most recent call last):
...
TypeError: g() got multiple values for keyword argument 'x'
TypeError: test.test_extcall.g() got multiple values for keyword argument 'x'

>>> g(**MultiDict([('a', 3)]), **MultiDict([('x', 1), ('x', 2)]))
Traceback (most recent call last):
...
TypeError: g() got multiple values for keyword argument 'x'
TypeError: test.test_extcall.g() got multiple values for keyword argument 'x'

Another helper function

Expand Down
10 changes: 5 additions & 5 deletions