Author: Alex Gaynor <[email protected]>
Branch:
Changeset: r70233:fe72a15b0882
Date: 2014-03-24 00:26 -0700
http://bitbucket.org/pypy/pypy/changeset/fe72a15b0882/
Log: Merged in msabramo/pypy/refactor_PyErr_SetFromErrnoWithFilename
(pull request #213)
Refactor PyErr_SetFromErrnoWithFilename in terms of
PyErr_SetFromErrnoWithFilenameObject
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
@@ -150,19 +150,13 @@
this is used to define the filename attribute of the exception instance.
Return value: always NULL."""
# XXX Doesn't actually do anything with PyErr_CheckSignals.
- errno = get_errno()
- msg = os.strerror(errno)
if llfilename:
w_filename = rffi.charp2str(llfilename)
- w_error = space.call_function(w_type,
- space.wrap(errno),
- space.wrap(msg),
- space.wrap(w_filename))
+ filename = space.wrap(w_filename)
else:
- w_error = space.call_function(w_type,
- space.wrap(errno),
- space.wrap(msg))
- raise OperationError(w_type, w_error)
+ filename = space.w_None
+
+ PyErr_SetFromErrnoWithFilenameObject(space, w_type, filename)
@cpython_api([PyObject, PyObject], PyObject)
def PyErr_SetFromErrnoWithFilenameObject(space, w_type, w_value):
@@ -171,6 +165,7 @@
third parameter. In the case of exceptions such as IOError and OSError,
this is used to define the filename attribute of the exception instance.
Return value: always NULL."""
+ # XXX Doesn't actually do anything with PyErr_CheckSignals.
errno = get_errno()
msg = os.strerror(errno)
if w_value:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit