]> granicus.if.org Git - python/commitdiff
Fix errors found by pychecker.
authorNeal Norwitz <nnorwitz@gmail.com>
Sun, 11 Jun 2006 07:27:56 +0000 (07:27 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sun, 11 Jun 2006 07:27:56 +0000 (07:27 +0000)
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.

Lib/pstats.py

index c3a88284ca7022b29dbe34e03a29c78c18fd2166..4e94b0ce0ee344654828757cfe90f73ba39ccb16 100644 (file)
@@ -548,8 +548,10 @@ if __name__ == '__main__':
             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 @@ if __name__ == '__main__':
             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