Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 44c5823

Browse files
committed
Merged revisions 83385-83389,83391 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k ........ r83385 | georg.brandl | 2010-08-01 08:42:45 +0200 (So, 01 Aug 2010) | 1 line #8773: mailbox.py does not need to be executable. ........ r83386 | georg.brandl | 2010-08-01 08:44:46 +0200 (So, 01 Aug 2010) | 1 line #8768: name test method properly so that it gets executed. ........ r83387 | georg.brandl | 2010-08-01 08:53:28 +0200 (So, 01 Aug 2010) | 1 line #8735: better explain semantics of *values* argument for parse(). ........ r83388 | georg.brandl | 2010-08-01 09:48:43 +0200 (So, 01 Aug 2010) | 1 line #7395: fix traceback in do_add() when no stats are loaded. Apply same fix for do_sort() and do_reverse(). ........ r83389 | georg.brandl | 2010-08-01 09:57:47 +0200 (So, 01 Aug 2010) | 1 line Small improvements to pstats browser: do not crash on reading invalid file, and actually do a reload when executing "read" as intended. ........ r83391 | georg.brandl | 2010-08-01 10:10:08 +0200 (So, 01 Aug 2010) | 1 line Add another news entry. ........
1 parent a70070c commit 44c5823

5 files changed

Lines changed: 30 additions & 8 deletions

File tree

Doc/library/optparse.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,8 +1228,9 @@ where the input parameters are
12281228
the list of arguments to process (default: ``sys.argv[1:]``)
12291229

12301230
``values``
1231-
object to store option arguments in (default: a new instance of
1232-
:class:`optparse.Values`)
1231+
a :class:`optparse.Values` object to store option arguments in (default: a
1232+
new instance of :class:`Values`) -- if you give an existing object, the
1233+
option defaults will not be initialized on it
12331234

12341235
and the return values are
12351236

Lib/mailbox.py

100755100644
File mode changed.

Lib/pstats.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,10 @@ def generic_help(self):
596596
print(" that match it are printed.", file=self.stream)
597597

598598
def do_add(self, line):
599-
self.stats.add(line)
599+
if self.stats:
600+
self.stats.add(line)
601+
else:
602+
print("No statistics object is loaded.", file=self.stream)
600603
return 0
601604
def help_add(self):
602605
print("Add profile info from given file to current statistics object.", file=self.stream)
@@ -631,22 +634,33 @@ def do_read(self, line):
631634
except IOError as err:
632635
print(err.args[1], file=self.stream)
633636
return
637+
except Exception as err:
638+
print(err.__class__.__name__ + ':', err, file=self.stream)
639+
return
634640
self.prompt = line + "% "
635641
elif len(self.prompt) > 2:
636-
line = self.prompt[-2:]
642+
line = self.prompt[:-2]
643+
self.do_read(line)
637644
else:
638645
print("No statistics object is current -- cannot reload.", file=self.stream)
639646
return 0
640647
def help_read(self):
641648
print("Read in profile data from a specified file.", file=self.stream)
649+
print("Without argument, reload the current file.", file=self.stream)
642650

643651
def do_reverse(self, line):
644-
self.stats.reverse_order()
652+
if self.stats:
653+
self.stats.reverse_order()
654+
else:
655+
print("No statistics object is loaded.", file=self.stream)
645656
return 0
646657
def help_reverse(self):
647658
print("Reverse the sort order of the profiling report.", file=self.stream)
648659

649660
def do_sort(self, line):
661+
if not self.stats:
662+
print("No statistics object is loaded.", file=self.stream)
663+
return
650664
abbrevs = self.stats.get_sort_arg_defs()
651665
if line and not filter(lambda x,a=abbrevs: x not in a,line.split()):
652666
self.stats.sort_stats(*line.split())
@@ -668,11 +682,16 @@ def help_stats(self):
668682
self.generic_help()
669683

670684
def do_strip(self, line):
671-
self.stats.strip_dirs()
672-
return 0
685+
if self.stats:
686+
self.stats.strip_dirs()
687+
else:
688+
print("No statistics object is loaded.", file=self.stream)
673689
def help_strip(self):
674690
print("Strip leading path information from filenames in the report.", file=self.stream)
675691

692+
def help_help(self):
693+
print("Show help for a given command.", file=self.stream)
694+
676695
def postcmd(self, stop, line):
677696
if stop:
678697
return stop

Lib/test/test_set.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ def test_self_symmetric_difference(self):
797797
result = self.set ^ self.set
798798
self.assertEqual(result, empty_set)
799799

800-
def checkempty_symmetric_difference(self):
800+
def test_empty_symmetric_difference(self):
801801
result = self.set ^ empty_set
802802
self.assertEqual(result, self.set)
803803

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ C-API
8484
Library
8585
-------
8686

87+
- Issue #7395: Fix tracebacks in pstats interactive browser.
88+
8789
- Issue #1713: Fix os.path.ismount(), which returned true for symbolic links
8890
across devices.
8991

0 commit comments

Comments
 (0)