[pypy-svn] r73154 - pypy/branch/cpython-extension/pypy/module/cpyext
xoraxax at codespeak.net
xoraxax at codespeak.net
Tue Mar 30 02:37:09 CEST 2010
Author: xoraxax
Date: Tue Mar 30 02:37:07 2010
New Revision: 73154
Modified:
pypy/branch/cpython-extension/pypy/module/cpyext/api.py
Log:
Build two exceptions differently to make them RPython.
Modified: pypy/branch/cpython-extension/pypy/module/cpyext/api.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/api.py (original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/api.py Tue Mar 30 02:37:07 2010
@@ -351,7 +351,10 @@
if ref != ref_type and space.is_w(from_ref(space, ref_type), space.w_str):
return force_string(space, ref)
else:
- raise InvalidPointerException("Got invalid reference to a PyObject: %r" % (ref, ))
+ msg = ""
+ if not we_are_translated():
+ msg = "Got invalid reference to a PyObject: %r" % (ref, )
+ raise InvalidPointerException(msg)
return obj
@@ -431,8 +434,8 @@
if failed:
error_value = callable.api_func.error_value
if error_value is CANNOT_FAIL:
- raise SystemError("The function %r was not supposed to fail"
- % (callable,))
+ raise SystemError("The function '%s' was not supposed to fail"
+ % (callable.__name__,))
return error_value
if callable.api_func.restype is PyObject:
More information about the Pypy-commit
mailing list