mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Issue #27241: Catch exception when running pstats as main.
This commit is contained in:
parent
7bfbd1d3c5
commit
e12a68be35
1 changed files with 4 additions and 1 deletions
|
|
@ -574,7 +574,10 @@ if __name__ == '__main__':
|
|||
|
||||
def do_add(self, line):
|
||||
if self.stats:
|
||||
self.stats.add(line)
|
||||
try:
|
||||
self.stats.add(line)
|
||||
except IOError as e:
|
||||
print("Failed to load statistics for %s: %s" % (line, e), file=self.stream)
|
||||
else:
|
||||
print("No statistics object is loaded.", file=self.stream)
|
||||
return 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue