[pypy-svn] r69297 - in pypy/branch/faster-raise/pypy/module/exceptions: . test
fijal at codespeak.net
fijal at codespeak.net
Sun Nov 15 10:47:12 CET 2009
Author: fijal
Date: Sun Nov 15 10:47:11 2009
New Revision: 69297
Modified:
pypy/branch/faster-raise/pypy/module/exceptions/interp_exceptions.py
pypy/branch/faster-raise/pypy/module/exceptions/test/test_exc.py
Log:
Bah. People do pass random crap as arguments to IOError
Modified: pypy/branch/faster-raise/pypy/module/exceptions/interp_exceptions.py
==============================================================================
--- pypy/branch/faster-raise/pypy/module/exceptions/interp_exceptions.py (original)
+++ pypy/branch/faster-raise/pypy/module/exceptions/interp_exceptions.py Sun Nov 15 10:47:11 2009
@@ -335,12 +335,13 @@
if (not space.is_w(self.w_errno, space.w_None) and
not space.is_w(self.w_strerror, space.w_None)):
if not space.is_w(self.w_filename, space.w_None):
- return space.wrap("[Errno %d] %s: %s" % (
- space.int_w(self.w_errno),
+ return space.wrap("[Errno %s] %s: %s" % (
+ space.str_w(space.str(self.w_errno)),
space.str_w(self.w_strerror),
space.str_w(space.repr(self.w_filename))))
- return space.wrap("[Errno %d] %s" % (space.int_w(self.w_errno),
- space.str_w(self.w_strerror)))
+ return space.wrap("[Errno %s] %s" %
+ (space.str_w(space.str(self.w_errno)),
+ space.str_w(self.w_strerror)))
return W_BaseException.descr_str(self, space)
descr_str.unwrap_spec = ['self', ObjSpace]
Modified: pypy/branch/faster-raise/pypy/module/exceptions/test/test_exc.py
==============================================================================
--- pypy/branch/faster-raise/pypy/module/exceptions/test/test_exc.py (original)
+++ pypy/branch/faster-raise/pypy/module/exceptions/test/test_exc.py Sun Nov 15 10:47:11 2009
@@ -56,6 +56,7 @@
assert isinstance(Exception(), Exception)
assert isinstance(Exception(), BaseException)
assert repr(Exception(3, "x")) == "Exception(3, 'x')"
+ assert str(IOError("foo", "bar")) == "[Errno foo] bar"
def test_custom_class(self):
from exceptions import Exception, BaseException, LookupError
More information about the Pypy-commit
mailing list