Author: Marc Abramowitz <[email protected]>
Branch: refactor_PyErr_SetFromErrnoWithFilename
Changeset: r70232:cbc7da63cd1c
Date: 2014-03-24 00:23 -0700
http://bitbucket.org/pypy/pypy/changeset/cbc7da63cd1c/
Log: 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