diff --git a/jsonweb/decode.py b/jsonweb/decode.py index 8f77eee..9d1eb1e 100644 --- a/jsonweb/decode.py +++ b/jsonweb/decode.py @@ -231,7 +231,7 @@ def decode_obj(self, obj): def get_arg_spec(func): - arg_spec = inspect.getargspec(func) + arg_spec = inspect.getfullargspec(func) args = arg_spec.args try: diff --git a/jsonweb/tests/test_decode.py b/jsonweb/tests/test_decode.py index d9e0199..bd876c7 100644 --- a/jsonweb/tests/test_decode.py +++ b/jsonweb/tests/test_decode.py @@ -355,4 +355,16 @@ def __init__(self, title): self.assertEqual(decode._as_type_context.top, Person) - self.assertEqual(decode._as_type_context.top, None) + self.assertEqual(decode._as_type_context.top, None) + + def test_decode_with_py3_type_annotation(self): + @decode.from_object() + class Person: + def __init__(self, name: str): + self.name = name + + json_str = '{"__type__": "Person", "name": "shawn"}' + person = loader(json_str) + + self.assertTrue(isinstance(person, Person)) + self.assertEqual(person.name, "shawn") diff --git a/setup.py b/setup.py index 31f94ef..eb8f6a1 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ import os from setuptools import setup, find_packages -version = '0.8.2' +version = '0.8.3' if os.path.exists("README.rst"): long_description = open("README.rst").read()