# HG changeset patch # User Paul Boddie # Date 1480346602 -3600 # Node ID 09a101949b5ce781384ed9f233b4e31f0a174b50 # Parent 227a5afd2cb6ac5aff8b000a05aa3b4af0e126a4 Provide a special class for modules. diff -r 227a5afd2cb6 -r 09a101949b5c inspector.py --- a/inspector.py Mon Nov 28 15:52:53 2016 +0100 +++ b/inspector.py Mon Nov 28 16:23:22 2016 +0100 @@ -76,7 +76,7 @@ # Set the class of the module after the definition has occurred. - ref = self.get_builtin("object") + ref = self.get_builtin("module") self.set_name("__class__", ref) # Get module-level attribute usage details. diff -r 227a5afd2cb6 -r 09a101949b5c lib/__builtins__/__init__.py --- a/lib/__builtins__/__init__.py Mon Nov 28 15:52:53 2016 +0100 +++ b/lib/__builtins__/__init__.py Mon Nov 28 16:23:22 2016 +0100 @@ -19,7 +19,7 @@ this program. If not, see . """ -from __builtins__.core import function, get_using, object, type, \ +from __builtins__.core import function, get_using, module, object, type, \ BaseException, Exception, MemoryError, TypeError, \ UnboundMethodInvocation, Warning diff -r 227a5afd2cb6 -r 09a101949b5c lib/__builtins__/core.py --- a/lib/__builtins__/core.py Mon Nov 28 15:52:53 2016 +0100 +++ b/lib/__builtins__/core.py Mon Nov 28 16:23:22 2016 +0100 @@ -45,6 +45,18 @@ __repr__ = __str__ +class module: + + "The class of module objects." + + def __str__(self): + + "Return a string representation." + + return self.__name__ + + __repr__ = __str__ + class function: """