[pypy-svn] r5351 - pypy/trunk/src/pypy/interpreter

arigo at codespeak.net arigo at codespeak.net
Sat Jun 26 12:43:35 CEST 2004


Author: arigo
Date: Sat Jun 26 12:43:31 2004
New Revision: 5351

Modified:
   pypy/trunk/src/pypy/interpreter/function.py
Log:
use code.getdocstring() from Function.func_doc.


Modified: pypy/trunk/src/pypy/interpreter/function.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/function.py	(original)
+++ pypy/trunk/src/pypy/interpreter/function.py	Sat Jun 26 12:43:31 2004
@@ -18,7 +18,7 @@
     def __init__(self, space, code, w_globals=None, defs_w=[], closure=None, forcename=None):
         self.space = space
         self.name = forcename or code.co_name
-        self.w_doc = None   # lazily read and wrapped from code.co_consts[0]
+        self.w_doc = None   # lazily read and wrapped from code.getdocstring()
         self.code = code       # Code instance
         self.w_func_globals = w_globals  # the globals dictionary
         self.closure   = closure    # normally, list of Cell instances or None
@@ -64,8 +64,7 @@
     def fget_func_doc(space, w_self):
         self = space.unwrap(w_self)
         if self.w_doc is None:
-            doc = getattr(self.code, 'co_consts', (None,))[0]
-            self.w_doc = space.wrap(doc)
+            self.w_doc = space.wrap(self.code.getdocstring())
         return self.w_doc
 
     def fset_func_doc(space, w_self, w_doc):



More information about the Pypy-commit mailing list