[pypy-svn] r20550 - pypy/branch/somepbc-refactoring/pypy/tool

arigo at codespeak.net arigo at codespeak.net
Thu Dec 1 23:44:38 CET 2005


Author: arigo
Date: Thu Dec  1 23:44:38 2005
New Revision: 20550

Modified:
   pypy/branch/somepbc-refactoring/pypy/tool/sourcetools.py
Log:
(tismer, replayed from r19693)

support display of source attached by compile2


Modified: pypy/branch/somepbc-refactoring/pypy/tool/sourcetools.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/tool/sourcetools.py	(original)
+++ pypy/branch/somepbc-refactoring/pypy/tool/sourcetools.py	Thu Dec  1 23:44:38 2005
@@ -101,8 +101,11 @@
     find the parameters of formatting generated methods and
     functions.
     """
-    src = inspect.getsource(object)
     name = inspect.getfile(object)
+    if hasattr(name, '__source__'):
+        src = str(name.__source__)
+    else:
+        src = inspect.getsource(object)
     if hasattr(name, "__sourceargs__"):
         return src % name.__sourceargs__
     return src



More information about the Pypy-commit mailing list