[pypy-svn] pypy default: Fix translation.

alex_gaynor commits-noreply at bitbucket.org
Mon Feb 28 07:13:10 CET 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r42333:d9f29729ac37
Date: 2011-02-28 01:12 -0500
http://bitbucket.org/pypy/pypy/changeset/d9f29729ac37/

Log:	Fix translation.

diff --git a/pypy/module/cpyext/pyerrors.py b/pypy/module/cpyext/pyerrors.py
--- a/pypy/module/cpyext/pyerrors.py
+++ b/pypy/module/cpyext/pyerrors.py
@@ -45,7 +45,7 @@
     If the error indicator is not set, set all three variables to NULL.  If it is
     set, it will be cleared and you own a reference to each object retrieved.  The
     value and traceback object may be NULL even when the type object is not.
-    
+
     This function is normally only used by code that needs to handle exceptions or
     by code that needs to save and restore the error indicator temporarily."""
     state = space.fromcache(State)
@@ -70,7 +70,7 @@
     reference to each object before the call and after the call you no longer own
     these references.  (If you don't understand this, don't use this function.  I
     warned you.)
-    
+
     This function is normally only used by code that needs to save and restore the
     error indicator temporarily; use PyErr_Fetch() to save the current
     exception state."""
@@ -100,7 +100,7 @@
     """This is a shorthand for PyErr_SetString(PyExc_TypeError, message), where
     message indicates that a built-in operation was invoked with an illegal
     argument.  It is mostly for internal use."""
-    raise OperationError(space.w_TypeError, 
+    raise OperationError(space.w_TypeError,
             space.wrap("bad argument type for built-in operation"))
 
 @cpython_api([], lltype.Void)
@@ -198,7 +198,7 @@
     the  currently executing line of code in that stack frame.  A stacklevel of 1
     is the function calling PyErr_WarnEx(), 2 is  the function above that,
     and so forth.
-    
+
     This function normally prints a warning message to sys.stderr; however, it is
     also possible that the user has specified that warnings are to be turned into
     errors, and in that case this will raise an exception.  It is also possible that
@@ -210,7 +210,7 @@
     intentional.)  If an exception is raised, the caller should do its normal
     exception handling (for example, Py_DECREF() owned references and return
     an error value).
-    
+
     Warning categories must be subclasses of Warning; the default warning
     category is RuntimeWarning.  The standard Python warning categories are
     available as global variables whose names are PyExc_ followed by the Python
@@ -221,7 +221,7 @@
     PyExc_FutureWarning.  PyExc_Warning is a subclass of
     PyExc_Exception; the other warning categories are subclasses of
     PyExc_Warning.
-    
+
     For information about warning control, see the documentation for the
     warnings module and the -W option in the command line
     documentation.  There is no C API for warning control."""
@@ -241,7 +241,7 @@
     below) or NULL; the message argument is a message string.  The warning will
     appear to be issued from the function calling PyErr_Warn(), equivalent to
     calling PyErr_WarnEx() with a stacklevel of 1.
-    
+
     Deprecated; use PyErr_WarnEx() instead."""
     return PyErr_WarnEx(space, w_category, message, 1)
 
@@ -291,12 +291,12 @@
     exception has been set but it is impossible for the interpreter to actually
     raise the exception.  It is used, for example, when an exception occurs in
     an __del__() method.
-    
+
     The function is called with a single argument obj that identifies the
     context in which the unraisable exception occurred. The repr of obj will be
     printed in the warning message."""
-    
+
     state = space.fromcache(State)
     operror = state.clear_exception()
     if operror:
-        operror.write_unraisable(space, w_where)
+        operror.write_unraisable(space, space.str_w(space.repr(w_where)))

diff --git a/pypy/module/cpyext/test/test_pyerrors.py b/pypy/module/cpyext/test/test_pyerrors.py
--- a/pypy/module/cpyext/test/test_pyerrors.py
+++ b/pypy/module/cpyext/test/test_pyerrors.py
@@ -68,7 +68,7 @@
         api.PyErr_NoMemory()
         assert space.eq_w(state.operror.w_type, space.w_MemoryError)
         api.PyErr_Clear()
-        
+
     def test_BadArgument(self, space, api):
         api.PyErr_BadArgument()
         state = space.fromcache(State)
@@ -94,8 +94,7 @@
         w_where = space.wrap("location")
         api.PyErr_WriteUnraisable(w_where)
         out, err = capfd.readouterr()
-        assert ("Exception ValueError: 'message' "
-                "in W_StringObject('location') ignored") == err.strip()
+        assert "Exception ValueError: 'message' in 'location' ignored" == err.strip()
 
 class AppTestFetch(AppTestCpythonExtensionBase):
     def setup_class(cls):


More information about the Pypy-commit mailing list