[pypy-commit] pypy default: issue #2067: fix the error message

arigo noreply at buildbot.pypy.org
Thu Jun 18 15:12:50 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r78179:8324e92a5b49
Date: 2015-06-18 15:12 +0200
http://bitbucket.org/pypy/pypy/changeset/8324e92a5b49/

Log:	issue #2067: fix the error message

diff --git a/pypy/module/_socket/interp_func.py b/pypy/module/_socket/interp_func.py
--- a/pypy/module/_socket/interp_func.py
+++ b/pypy/module/_socket/interp_func.py
@@ -2,7 +2,7 @@
 from rpython.rlib.rsocket import SocketError, INVALID_SOCKET
 from rpython.rlib.rarithmetic import intmask
 
-from pypy.interpreter.error import OperationError
+from pypy.interpreter.error import OperationError, oefmt
 from pypy.interpreter.gateway import unwrap_spec, WrappedDefault
 from pypy.module._socket.interp_socket import (
     converted_error, W_Socket, addr_as_object, ipaddr_from_object
@@ -247,9 +247,9 @@
         ip = rsocket.inet_ntop(family, packed)
     except SocketError, e:
         raise converted_error(space, e)
-    except ValueError, e:     # XXX the message is lost in RPython
-        raise OperationError(space.w_ValueError,
-                  space.wrap(str(e)))
+    except ValueError:
+        raise oefmt(space.w_ValueError,
+                    "invalid length of packed IP address string")
     return space.wrap(ip)
 
 @unwrap_spec(family=int, socktype=int, proto=int, flags=int)


More information about the pypy-commit mailing list