summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2016-08-02 20:30:24 (GMT)
committerStefan Krah <skrah@bytereef.org>2016-08-02 20:30:24 (GMT)
commite12a68be3580a3c7b80d384b2664b1921a7ff55b (patch)
tree2e1e75e12dac90381c13013e37308b3ab43c3a17 /Lib
parent7bfbd1d3c56b2a5281edeb7a8e21598618b7c1a3 (diff)
downloadcpython-e12a68be3580a3c7b80d384b2664b1921a7ff55b.zip
cpython-e12a68be3580a3c7b80d384b2664b1921a7ff55b.tar.gz
cpython-e12a68be3580a3c7b80d384b2664b1921a7ff55b.tar.bz2
Issue #27241: Catch exception when running pstats as main.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/pstats.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/pstats.py b/Lib/pstats.py
index e1ec355..d861413 100644
--- a/Lib/pstats.py
+++ b/Lib/pstats.py
@@ -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