PATCH: lsprof.py RuntimeError

Alejandro Santos alejolp at alejolp.com
Wed Jul 29 16:20:49 CDT 2009


On Wed, Jul 29, 2009 at 5:57 PM, Matt Mackall<mpm at selenic.com> wrote:
> On Wed, 2009-07-29 at 17:33 -0300, Alejandro Santos wrote:
>> diff -r 1eed391889f4 -r d1d8947179b7 mercurial/lsprof.py
>> --- a/mercurial/lsprof.py     Wed Jul 29 00:20:28 2009 -0300
>> +++ b/mercurial/lsprof.py     Wed Jul 29 17:29:52 2009 -0300
>> @@ -85,7 +85,20 @@
>>      try:
>>          mname = _fn2mod[code.co_filename]
>>      except KeyError:
>> -        for k, v in sys.modules.iteritems():
>> +        # Force the complete load of all the lazy and on demand modules by
>> +        # querying one of the module's attribute.
>
> Why is this necessary? If we didn't load it already, why is it
> interesting to the profiler?

Let's assume that module a imports b, b imports c and c imports d.

If module b or c are loaded lazily or on demand, the profiler will
have no knowledge about the last module d.

-- 
Alejandro Santos,
alejolp at alejolp.com.ar
http://www.alejolp.com.ar



More information about the Mercurial-devel mailing list