1.1 --- a/micropython/inspect.py Thu Sep 24 21:29:29 2009 +0200
1.2 +++ b/micropython/inspect.py Fri Sep 25 00:35:17 2009 +0200
1.3 @@ -129,6 +129,14 @@
1.4
1.5 self.astnode = self.module = module
1.6
1.7 + # Add __name__ to the namespace by adding an explicit assignment to the
1.8 + # module.
1.9 +
1.10 + module.node.nodes.insert(0, compiler.ast.Assign(
1.11 + [compiler.ast.AssName("__name__", 0)],
1.12 + compiler.ast.Const(self.full_name())
1.13 + ))
1.14 +
1.15 # First, visit module-level code, recording global names.
1.16
1.17 processed = self.dispatch(module)