[Idle-dev] CVS: idle PyShell.py,1.2,1.3

Kurt B. Kaiser kbk@users.sourceforge.net
Fri, 13 Jul 2001 17:13:31 -0700


Update of /cvsroot/idlefork/idle
In directory usw-pr-cvs1:/tmp/cvs-serv25110

Modified Files:
	PyShell.py 
Log Message:
cvs-py-rel2_1 (Rev 1.29 - 1.33) merge

Merged the following py-cvs revs without conflict:
1.29 Reduce copyright text output at startup
1.30 Delay setting sys.args until Tkinter is fully initialized
1.31 Whitespace normalization
1.32 Turn syntax warning into error when interactive
1.33 Fix warning initialization bug

Note that module is extensively modified wrt py-cvs


Index: PyShell.py
===================================================================
RCS file: /cvsroot/idlefork/idle/PyShell.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** PyShell.py	2001/07/04 03:15:10	1.2
--- PyShell.py	2001/07/14 00:13:28	1.3
***************
*** 28,31 ****
--- 28,32 ----
  import re
  import protocol
+ import warnings
  
  import linecache
***************
*** 147,151 ****
          "console": cconf.getcolor("console"),
          "ERROR": cconf.getcolor("ERROR"),
! 	None: cconf.getcolor("normal"),
      })
  
--- 148,152 ----
          "console": cconf.getcolor("console"),
          "ERROR": cconf.getcolor("ERROR"),
!         None: cconf.getcolor("normal"),
      })
  
***************
*** 179,182 ****
--- 180,184 ----
          locals = sys.modules['__main__'].__dict__
          InteractiveInterpreter.__init__(self, locals=locals)
+         self.save_warnings_filters = None
  
      gid = 0
***************
*** 203,207 ****
          filename = self.stuffsource(source)
          self.more = 0
!         return InteractiveInterpreter.runsource(self, source, filename)
  
      def stuffsource(self, source):
--- 205,216 ----
          filename = self.stuffsource(source)
          self.more = 0
!         self.save_warnings_filters = warnings.filters[:]
!         warnings.filterwarnings(action="error", category=SyntaxWarning)
!         try:
!             return InteractiveInterpreter.runsource(self, source, filename)
!         finally:
!             if self.save_warnings_filters is not None:
!                 warnings.filters[:] = self.save_warnings_filters
!                 self.save_warnings_filters = None
  
      def stuffsource(self, source):
***************
*** 272,275 ****
--- 281,287 ----
      def runcode(self, code):
          # Override base class method
+         if self.save_warnings_filters is not None:
+             warnings.filters[:] = self.save_warnings_filters
+             self.save_warnings_filters = None
          debugger = self.debugger
          try:
***************
*** 452,459 ****
          return self.shell_title
  
      def begin(self):
          self.resetoutput()
          self.write("Python %s on %s\n%s\nIDLE %s -- press F1 for help\n" %
!                    (sys.version, sys.platform, sys.copyright,
                      idlever.IDLE_VERSION))
          try:
--- 464,474 ----
          return self.shell_title
  
+     COPYRIGHT = \
+               'Type "copyright", "credits" or "license" for more information.'
+ 
      def begin(self):
          self.resetoutput()
          self.write("Python %s on %s\n%s\nIDLE %s -- press F1 for help\n" %
!                    (sys.version, sys.platform, self.COPYRIGHT,
                      idlever.IDLE_VERSION))
          try:
***************
*** 791,800 ****
          if noshell: edit=1
      
-         if not edit:
-             if cmd:
-                 sys.argv = ["-c"] + args
-             else:
-                 sys.argv = args or [""]
-     
          for i in range(len(sys.path)):
              sys.path[i] = os.path.abspath(sys.path[i])
--- 806,809 ----
***************
*** 814,818 ****
  
          global flist, root
!         root = Tk()
          fixwordbreaks(root)
          root.withdraw()
--- 823,827 ----
  
          global flist, root
!         root = Tk(className="Idle")
          fixwordbreaks(root)
          root.withdraw()
***************
*** 824,828 ****
              if not args:
                  flist.new()
!     
          #dbg=OnDemandOutputWindow(flist)
          #dbg.set_title('Internal IDLE Problem')
--- 833,842 ----
              if not args:
                  flist.new()
!         else:
!             if cmd:
!                 sys.argv = ["-c"] + args
!             else:
!                 sys.argv = args or [""]
! 
          #dbg=OnDemandOutputWindow(flist)
          #dbg.set_title('Internal IDLE Problem')