aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mitmproxy/stateobject.py5
-rw-r--r--setup.py2
2 files changed, 3 insertions, 4 deletions
diff --git a/mitmproxy/stateobject.py b/mitmproxy/stateobject.py
index 6283d845..8db6cda3 100644
--- a/mitmproxy/stateobject.py
+++ b/mitmproxy/stateobject.py
@@ -8,8 +8,7 @@ import netlib.basetypes
def _is_list(cls):
- # The typing module backport is somewhat broken.
- # Python 3.5 or 3.6 should fix this.
+ # The typing module is broken on Python 3.5.0, fixed on 3.5.1.
is_list_bugfix = getattr(cls, "__origin__", False) == getattr(List[Any], "__origin__", True)
return issubclass(cls, List) or is_list_bugfix
@@ -63,7 +62,7 @@ class StateObject(netlib.basetypes.Serializable):
obj = cls.from_state(state.pop(attr))
setattr(self, attr, obj)
elif _is_list(cls):
- cls = cls.__parameters__[0]
+ cls = cls.__parameters__[0] if cls.__parameters__ else cls.__args__[0]
setattr(self, attr, [cls.from_state(x) for x in state.pop(attr)])
else: # primitive types such as int, str, ...
setattr(self, attr, cls(state.pop(attr)))
diff --git a/setup.py b/setup.py
index 04c1a8ae..564eb4d7 100644
--- a/setup.py
+++ b/setup.py
@@ -80,7 +80,6 @@ setup(
"requests>=2.9.1, <2.11",
"six>=1.10, <1.11",
"tornado>=4.3, <4.4",
- "typing>=3.5.2, <3.6",
"urwid>=1.3.1, <1.4",
"watchdog>=0.8.3, <0.9",
],
@@ -95,6 +94,7 @@ setup(
':python_version == "2.7"': [
"enum34>=1.0.4, <2",
"ipaddress>=1.0.15, <1.1",
+ "typing==3.5.2.2",
],
'dev': [
"tox>=2.3, <3",