[pyrepl-checkins] r47089 - pyrepl/trunk/pyrepl/pyrepl

fijal at codespeak.net fijal at codespeak.net
Tue Oct 2 11:53:31 CEST 2007


Author: fijal
Date: Tue Oct  2 11:53:30 2007
New Revision: 47089

Modified:
   pyrepl/trunk/pyrepl/pyrepl/python_reader.py
Log:
Add a flag, which allows not to clear main (so we can access it, even when
pyrepl is not __main__)


Modified: pyrepl/trunk/pyrepl/pyrepl/python_reader.py
==============================================================================
--- pyrepl/trunk/pyrepl/pyrepl/python_reader.py	(original)
+++ pyrepl/trunk/pyrepl/pyrepl/python_reader.py	Tue Oct  2 11:53:30 2007
@@ -334,7 +334,7 @@
         self.cocoainteracter = CocoaInteracter.alloc().init(self, inputfilehandle, outputfilehandle)
         
         
-def main(use_pygame_console=0, interactmethod=default_interactmethod, print_banner=True):
+def main(use_pygame_console=0, interactmethod=default_interactmethod, print_banner=True, clear_main=True):
     si, se, so = sys.stdin, sys.stderr, sys.stdout
     try:
         if 0 and use_pygame_console: # pygame currently borked
@@ -373,7 +373,7 @@
                   'for more information.'
         sys.path.insert(0, os.getcwd())
 
-        if __name__ != '__main__':
+        if clear_main and __name__ != '__main__':
             mainmod = new.module('__main__')
             sys.modules['__main__'] = mainmod
         else:


More information about the pyrepl-checkins mailing list