1.1 --- a/translator.py Mon Dec 05 01:42:42 2016 +0100
1.2 +++ b/translator.py Mon Dec 05 13:01:21 2016 +0100
1.3 @@ -1497,13 +1497,17 @@
1.4 self.writeline("{")
1.5 self.indent += 1
1.6
1.7 - # Only use the normal return statement if no surrounding try blocks
1.8 - # apply.
1.9 + # Do not return anything at the module level.
1.10 +
1.11 + if self.get_namespace_path() != self.name:
1.12
1.13 - if not self.in_try_finally and not self.in_try_except:
1.14 - self.writeline("if (!__ISNULL(__tmp_exc.arg)) return __tmp_exc.arg;")
1.15 - else:
1.16 - self.writeline("if (!__ISNULL(__tmp_exc.arg)) __Throw(__tmp_exc);")
1.17 + # Only use the normal return statement if no surrounding try blocks
1.18 + # apply.
1.19 +
1.20 + if not self.in_try_finally and not self.in_try_except:
1.21 + self.writeline("if (!__ISNULL(__tmp_exc.arg)) return __tmp_exc.arg;")
1.22 + else:
1.23 + self.writeline("if (!__ISNULL(__tmp_exc.arg)) __Throw(__tmp_exc);")
1.24
1.25 self.indent -= 1
1.26 self.writeline("}")