diff options
author | Guido van Rossum <guido@python.org> | 1995-09-30 16:48:54 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-09-30 16:48:54 (GMT) |
commit | 4f399fb6429d7f84de1f881f1fc3968619d9af2e (patch) | |
tree | 5cbf0ea3a1fb8205b8d405704caa36834a2a7d03 /Lib/pstats.py | |
parent | 59c473be9914ef78a4f213174e0e9f1ae910f2f6 (diff) | |
download | cpython-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.py | 11 |
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__` \ |