diff -r 6216fb8afa53 Lib/pstats.py --- a/Lib/pstats.py Mon Jun 06 13:00:03 2016 +0300 +++ b/Lib/pstats.py Mon Jun 06 13:45:28 2016 -0400 @@ -574,7 +574,10 @@ 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