[pypy-svn] r61403 - pypy/trunk/pypy/module/_lsprof

antocuni at codespeak.net antocuni at codespeak.net
Tue Jan 27 18:03:21 CET 2009


Author: antocuni
Date: Tue Jan 27 18:03:20 2009
New Revision: 61403

Modified:
   pypy/trunk/pypy/module/_lsprof/interp_lsprof.py
Log:
try to be more careful for corner cases when classes don't have __name__ and
Functions don't have w_module



Modified: pypy/trunk/pypy/module/_lsprof/interp_lsprof.py
==============================================================================
--- pypy/trunk/pypy/module/_lsprof/interp_lsprof.py	(original)
+++ pypy/trunk/pypy/module/_lsprof/interp_lsprof.py	Tue Jan 27 18:03:20 2009
@@ -162,16 +162,18 @@
 def create_spec(space, w_arg):
     if isinstance(w_arg, Method):
         w_function = w_arg.w_function
-        w_class = w_arg.w_class
-        class_name = space.str_w(space.str(w_class))
+        class_name = w_arg.w_class.getname(space, '?')
         assert isinstance(w_function, Function)
         return "{method '%s' of '%s' objects}" % (w_function.name, class_name)
     elif isinstance(w_arg, Function):
-        module = space.str_w(w_arg.w_module)
-        if module == '__builtin__':
+        if w_arg.w_module is None:
             module = ''
         else:
-            module += '.'
+            module = space.str_w(w_arg.w_module)
+            if module == '__builtin__':
+                module = ''
+            else:
+                module += '.'
         return '{%s%s function}' % (module, w_arg.name)
     else:
         return '{!!!unknown!!!}'



More information about the Pypy-commit mailing list