summaryrefslogtreecommitdiffstats
path: root/Lib/pstats.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-09-30 16:48:54 (GMT)
committerGuido van Rossum <guido@python.org>1995-09-30 16:48:54 (GMT)
commit4f399fb6429d7f84de1f881f1fc3968619d9af2e (patch)
tree5cbf0ea3a1fb8205b8d405704caa36834a2a7d03 /Lib/pstats.py
parent59c473be9914ef78a4f213174e0e9f1ae910f2f6 (diff)
downloadcpython-4f399fb6429d7f84de1f881f1fc3968619d9af2e.zip
cpython-4f399fb6429d7f84de1f881f1fc3968619d9af2e.tar.gz
cpython-4f399fb6429d7f84de1f881f1fc3968619d9af2e.tar.bz2
more robust coding, adapted for mac
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__` \