[pypy-svn] rev 784 - pypy/trunk/src/pypy/objspace/std

mwh at codespeak.net mwh at codespeak.net
Sat Jun 7 20:56:36 CEST 2003


Author: mwh
Date: Sat Jun  7 20:56:36 2003
New Revision: 784

Modified:
   pypy/trunk/src/pypy/objspace/std/funcobject.py
Log:
expose .func_code on function objects


Modified: pypy/trunk/src/pypy/objspace/std/funcobject.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/funcobject.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/funcobject.py	Sat Jun  7 20:56:36 2003
@@ -48,3 +48,11 @@
     return W_InstMethObject(space, w_instance, w_function)
 
 StdObjSpace.get.register(func_get, W_FuncObject, W_ANY, W_ANY)
+
+def func_getattr(space, w_function, w_attr):
+    if space.is_true(space.eq(w_attr, space.wrap('func_code'))):
+        return space.wrap(w_function.code)
+    else:
+        raise FailedToImplement
+
+StdObjSpace.getattr.register(func_getattr, W_FuncObject, W_ANY)


More information about the Pypy-commit mailing list