aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/command.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2018-05-12 10:15:08 +1200
committerAldo Cortesi <aldo@corte.si>2018-05-12 10:15:08 +1200
commit6dff8c58adbcb9da9b7bdeb088148c3f0d364c02 (patch)
treecf716b1581de9ff1845658da00905c8723576f24 /mitmproxy/command.py
parent75d30212c253682f61d12b6cca5c910c798e18e1 (diff)
downloadmitmproxy-6dff8c58adbcb9da9b7bdeb088148c3f0d364c02.tar.gz
mitmproxy-6dff8c58adbcb9da9b7bdeb088148c3f0d364c02.tar.bz2
mitmproxy-6dff8c58adbcb9da9b7bdeb088148c3f0d364c02.zip
commands: if no explicit return type is specified, assume None
This is going to be a super common error for addon authors, so we might as well handle it.
Diffstat (limited to 'mitmproxy/command.py')
-rw-r--r--mitmproxy/command.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/mitmproxy/command.py b/mitmproxy/command.py
index 8f075525..cba2673c 100644
--- a/mitmproxy/command.py
+++ b/mitmproxy/command.py
@@ -58,7 +58,10 @@ class Command:
if i.kind == i.VAR_POSITIONAL:
self.has_positional = True
self.paramtypes = [v.annotation for v in sig.parameters.values()]
- self.returntype = sig.return_annotation
+ if sig.return_annotation == inspect._empty:
+ self.returntype = None
+ else:
+ self.returntype = sig.return_annotation
def paramnames(self) -> typing.Sequence[str]:
v = [typename(i) for i in self.paramtypes]