[pypy-svn] r76274 - pypy/trunk/pypy/module/cpyext

afa at codespeak.net afa at codespeak.net
Sat Jul 17 14:24:21 CEST 2010


Author: afa
Date: Sat Jul 17 14:24:19 2010
New Revision: 76274

Modified:
   pypy/trunk/pypy/module/cpyext/methodobject.py
Log:
Don't crash when ml_doc is left to NULL.
It happens when property() is called with a getter written in C.


Modified: pypy/trunk/pypy/module/cpyext/methodobject.py
==============================================================================
--- pypy/trunk/pypy/module/cpyext/methodobject.py	(original)
+++ pypy/trunk/pypy/module/cpyext/methodobject.py	Sat Jul 17 14:24:19 2010
@@ -100,7 +100,11 @@
             return generic_cpy_call(space, self.ml.c_ml_meth, w_self, w_arg)
 
     def get_doc(space, self):
-        return space.wrap(rffi.charp2str(self.ml.c_ml_doc))
+        doc = self.ml.c_ml_doc
+        if doc:
+            return space.wrap(rffi.charp2str(doc))
+        else:
+            return space.w_None
 
 
 class W_PyCMethodObject(W_PyCFunctionObject):



More information about the Pypy-commit mailing list