diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2016-03-02 16:08:05 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2016-03-02 16:08:05 (GMT) |
commit | 06495ffe93ce05840c42fbb31b56036c613a4656 (patch) | |
tree | 5c0ccabe1d8a08ee31c3bfbcc62d2795e1271268 /Lib | |
parent | a8ac8e336bcce0c890d171a019589f89f36dfdd5 (diff) | |
parent | f9e1f2bda930054eed3115e19e9f3f7bfc83c1b6 (diff) | |
download | cpython-06495ffe93ce05840c42fbb31b56036c613a4656.zip cpython-06495ffe93ce05840c42fbb31b56036c613a4656.tar.gz cpython-06495ffe93ce05840c42fbb31b56036c613a4656.tar.bz2 |
Merge 3.5 (issue #26347)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/inspect.py | 2 | ||||
-rw-r--r-- | Lib/test/test_inspect.py | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 74f3b3c..582bb0e 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -2571,8 +2571,6 @@ class BoundArguments: empty dict. """ arguments = self.arguments - if not arguments: - return new_arguments = [] for name, param in self._signature.parameters.items(): try: diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index 98d596e..76cebcc 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -3325,6 +3325,13 @@ class TestBoundArguments(unittest.TestCase): ba.apply_defaults() self.assertEqual(list(ba.arguments.items()), []) + # Make sure a no-args binding still acquires proper defaults. + def foo(a='spam'): pass + sig = inspect.signature(foo) + ba = sig.bind() + ba.apply_defaults() + self.assertEqual(list(ba.arguments.items()), [('a', 'spam')]) + class TestSignaturePrivateHelpers(unittest.TestCase): def test_signature_get_bound_param(self): |