summaryrefslogtreecommitdiff
path: root/Python/errors.c
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2002-07-29 14:27:41 +0000
committerThomas Heller <theller@ctypes.org>2002-07-29 14:27:41 +0000
commit1fd68ed1fbacb575a137fb4f87d7433c57b14123 (patch)
tree3717e7ae28b88763753aeb6e57f526469b148a3d /Python/errors.c
parent3b2a271ae45a815ae7991f652c80b41a837e6cd9 (diff)
downloadcpython-1fd68ed1fbacb575a137fb4f87d7433c57b14123.tar.gz
New functions for extension writers on Windows:
PyErr_SetExcFromWindowsErr(), PyErr_SetExcFromWindowsErrWithFilename(). Similar to PyErr_SetFromWindowsErrWithFilename() and PyErr_SetFromWindowsErr(), but they allow to specify the exception type to raise. Available on Windows. See SF patch #576458.
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/Python/errors.c b/Python/errors.c
index f744ad4653..61d1df0d75 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -337,7 +337,8 @@ PyErr_SetFromErrno(PyObject *exc)
#ifdef MS_WINDOWS
/* Windows specific error code handling */
-PyObject *PyErr_SetFromWindowsErrWithFilename(
+PyObject *PyErr_SetExcFromWindowsErrWithFilename(
+ PyObject *exc,
int ierr,
const char *filename)
{
@@ -366,16 +367,29 @@ PyObject *PyErr_SetFromWindowsErrWithFilename(
else
v = Py_BuildValue("(is)", err, s);
if (v != NULL) {
- PyErr_SetObject(PyExc_WindowsError, v);
+ PyErr_SetObject(exc, v);
Py_DECREF(v);
}
LocalFree(s);
return NULL;
}
+PyObject *PyErr_SetExcFromWindowsErr(PyObject *exc, int ierr)
+{
+ return PyErr_SetExcFromWindowsErrWithFilename(exc, ierr, NULL);
+}
+
PyObject *PyErr_SetFromWindowsErr(int ierr)
{
- return PyErr_SetFromWindowsErrWithFilename(ierr, NULL);
+ return PyErr_SetExcFromWindowsErrWithFilename(PyExc_WindowsError,
+ ierr, NULL);
+}
+PyObject *PyErr_SetFromWindowsErrWithFilename(
+ int ierr,
+ const char *filename)
+{
+ return PyErr_SetExcFromWindowsErrWithFilename(PyExc_WindowsError,
+ ierr, filename);
}
#endif /* MS_WINDOWS */