[Python-checkins] r46857 - python/trunk/Lib/pstats.py

neal.norwitz python-checkins at python.org
Sun Jun 11 09:27:56 CEST 2006


Author: neal.norwitz
Date: Sun Jun 11 09:27:56 2006
New Revision: 46857

Modified:
   python/trunk/Lib/pstats.py
Log:
Fix errors found by pychecker.
I think these changes are correct, but I'm not sure.  Could someone
who knows how this module works test it?  It can at least start on
the cmd line.


Modified: python/trunk/Lib/pstats.py
==============================================================================
--- python/trunk/Lib/pstats.py	(original)
+++ python/trunk/Lib/pstats.py	Sun Jun 11 09:27:56 2006
@@ -548,8 +548,10 @@
             self.prompt = "% "
             if profile is not None:
                 self.stats = Stats(profile)
+                self.stream = self.stats.stream
             else:
                 self.stats = None
+                self.stream = sys.stdout
 
         def generic(self, fn, line):
             args = line.split()
@@ -667,14 +669,15 @@
             return None
 
     import sys
-    print >> self.stream, "Welcome to the profile statistics browser."
     if len(sys.argv) > 1:
         initprofile = sys.argv[1]
     else:
         initprofile = None
     try:
-        ProfileBrowser(initprofile).cmdloop()
-        print >> self.stream, "Goodbye."
+        browser = ProfileBrowser(initprofile)
+        print >> browser.stream, "Welcome to the profile statistics browser."
+        browser.cmdloop()
+        print >> browser.stream, "Goodbye."
     except KeyboardInterrupt:
         pass
 


More information about the Python-checkins mailing list