[pypy-svn] r74660 - in pypy/trunk/pypy/module/cpyext: . test
afa at codespeak.net
afa at codespeak.net
Sat May 22 00:08:19 CEST 2010
Author: afa
Date: Sat May 22 00:08:18 2010
New Revision: 74660
Modified:
pypy/trunk/pypy/module/cpyext/pyerrors.py
pypy/trunk/pypy/module/cpyext/test/test_eval.py
Log:
Let PyErr_SetFromErrno use the type given as argument...
Modified: pypy/trunk/pypy/module/cpyext/pyerrors.py
==============================================================================
--- pypy/trunk/pypy/module/cpyext/pyerrors.py (original)
+++ pypy/trunk/pypy/module/cpyext/pyerrors.py Sat May 22 00:08:18 2010
@@ -1,7 +1,7 @@
import os
from pypy.rpython.lltypesystem import rffi, lltype
-from pypy.interpreter.error import OperationError, wrap_oserror
+from pypy.interpreter.error import OperationError
from pypy.module.cpyext.api import cpython_api, CANNOT_FAIL, CONST_STRING
from pypy.module.exceptions.interp_exceptions import W_RuntimeWarning
from pypy.module.cpyext.pyobject import (
@@ -116,7 +116,9 @@
Return value: always NULL."""
# XXX Doesn't actually do anything with PyErr_CheckSignals.
errno = get_errno()
- raise wrap_oserror(space, OSError(errno, "PyErr_SetFromErrno"))
+ msg = os.strerror(errno)
+ w_error = space.call_function(w_type, space.wrap(errno), space.wrap(msg))
+ raise OperationError(w_type, w_error)
@cpython_api([], rffi.INT_real, error=-1)
def PyErr_CheckSignals(space):
Modified: pypy/trunk/pypy/module/cpyext/test/test_eval.py
==============================================================================
--- pypy/trunk/pypy/module/cpyext/test/test_eval.py (original)
+++ pypy/trunk/pypy/module/cpyext/test/test_eval.py Sat May 22 00:08:18 2010
@@ -93,7 +93,7 @@
# retry on closed file
api.PyRun_File(fp, filename, Py_file_input, w_globals, w_locals)
- assert api.PyErr_Occurred() is space.w_OSError
+ assert api.PyErr_Occurred() is space.w_IOError
api.PyErr_Clear()
rffi.free_charp(filename)
More information about the Pypy-commit
mailing list