summaryrefslogtreecommitdiffstats
path: root/Lib/pstats.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/pstats.py')
-rw-r--r--Lib/pstats.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/Lib/pstats.py b/Lib/pstats.py
index 5a4601a..e87478e 100644
--- a/Lib/pstats.py
+++ b/Lib/pstats.py
@@ -116,13 +116,10 @@ class Stats:
except: # in case this is not unix
pass
self.files = [ arg ]
- elif type(arg) == type(self):
- try:
- arg.create_stats()
- self.stats = arg.stats
- arg.stats = {}
- except:
- pass
+ elif hasattr(arg, 'create_stats'):
+ arg.create_stats()
+ self.stats = arg.stats
+ arg.stats = {}
if not self.stats:
raise TypeError, "Cannot create or construct a " \
+ `self.__class__` \