--- pstats - Original.py 2010-10-21 11:26:06.370000000 +0200 +++ pstats.py 2010-10-21 17:28:48.446000000 +0200 @@ -147,28 +147,27 @@ def add(self, *arg_list): if not arg_list: return self - if len(arg_list) > 1: self.add(*arg_list[1:]) - other = arg_list[0] - if type(self) != type(other) or self.__class__ != other.__class__: - other = Stats(other) - self.files += other.files - self.total_calls += other.total_calls - self.prim_calls += other.prim_calls - self.total_tt += other.total_tt - for func in other.top_level: - self.top_level[func] = None - - if self.max_name_len < other.max_name_len: - self.max_name_len = other.max_name_len - - self.fcn_list = None - - for func, stat in other.stats.iteritems(): - if func in self.stats: - old_func_stat = self.stats[func] - else: - old_func_stat = (0, 0, 0, 0, {},) - self.stats[func] = add_func_stats(old_func_stat, stat) + for stat_item in arg_list: + if type(self) != type(stat_item) or self.__class__ != stat_item.__class__: + stat_item = Stats(stat_item) + self.files += stat_item.files + self.total_calls += stat_item.total_calls + self.prim_calls += stat_item.prim_calls + self.total_tt += stat_item.total_tt + for func in stat_item.top_level: + self.top_level[func] = None + + if self.max_name_len < stat_item.max_name_len: + self.max_name_len = stat_item.max_name_len + + self.fcn_list = None + + for func, stat in stat_item.stats.iteritems(): + if func in self.stats: + old_func_stat = self.stats[func] + else: + old_func_stat = (0, 0, 0, 0, {},) + self.stats[func] = add_func_stats(old_func_stat, stat) return self def dump_stats(self, filename):