From 81e428dd61ea103af1f681404a53086f6892bb24 Mon Sep 17 00:00:00 2001 From: Allan Feldman Date: Wed, 22 Feb 2017 11:29:48 -0800 Subject: [PATCH 1/2] Fix missing sys import for getcallargs backport. --- src/wrapt/arguments.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wrapt/arguments.py b/src/wrapt/arguments.py index 2537916..428ffae 100644 --- a/src/wrapt/arguments.py +++ b/src/wrapt/arguments.py @@ -4,6 +4,7 @@ # of the PSF license used for Python 2.7. from inspect import getargspec, ismethod +import sys def getcallargs(func, *positional, **named): """Get the mapping of arguments to values. From 09f65ff2a21cd00355193bcdee22a2289ead2d24 Mon Sep 17 00:00:00 2001 From: Allan Feldman Date: Wed, 22 Feb 2017 11:27:19 -0800 Subject: [PATCH 2/2] Add test for unexpected unicode kwargs. --- tests/test_arguments.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_arguments.py b/tests/test_arguments.py index 5c688ec..0b7379d 100644 --- a/tests/test_arguments.py +++ b/tests/test_arguments.py @@ -21,3 +21,10 @@ class TestArguments(unittest.TestCase): calculated = wrapt.getcallargs(function, 10, 20, 30, 40, 50, 60) self.assertEqual(expected, calculated) + + def test_unexpected_unicode_keyword(self): + def function(a=2): + pass + + kwargs = { u'b': 40 } + self.assertRaises(TypeError, wrapt.getcallargs, function, **kwargs)