This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Adam.Bielański
Recipients Adam.Bielański
Date 2010-10-21.15:50:11
SpamBayes Score 1.1422641e-11
Marked as misclassified No
Message-id <1287676214.72.0.937902766344.issue10166@psf.upfronthosting.co.za>
In-reply-to
Content
There's a bug in module lib\pstats.py, line 150. 

Let me paste a little piece of surrounding code:

    class Stats:
      (....)
        def add(self, *arg_list):
            if not arg_list: return self
            if len(arg_list) > 1: self.add(*arg_list[1:])  #Line 150, the problem is right here!
            other = arg_list[0]
            (... do some processing with first item from arg_list ...)

This is the code for adding profiling stats from multiple files (names are on arg_list) so that they can be displayed in cumulated and readable form.

As you can see it chops off the first item from the list and then uses recursion to process the rest of it. It's no wonder then that when you profiled a little too many function calls, you're bound to see RuntimeError with 'maximum recursion depth exceeded' message when you try using this. IMO this should be done with iteration instead, like:

        def add(self, *arg_list):
            if not arg_list: return self
            for other in arg_list: #Preserved variable name only for sake of comparison with previous snippet
                (... do some processing with each item from arg_list, merging results in some rightful manner ...)


You can find a patch for this issue in the attachment.
History
Date User Action Args
2010-10-21 15:50:14Adam.Bielańskisetrecipients: + Adam.Bielański
2010-10-21 15:50:14Adam.Bielańskisetmessageid: <1287676214.72.0.937902766344.issue10166@psf.upfronthosting.co.za>
2010-10-21 15:50:13Adam.Bielańskilinkissue10166 messages
2010-10-21 15:50:12Adam.Bielańskicreate