summaryrefslogtreecommitdiffstats
path: root/Python/errors.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 626b16e..1f955b5 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -588,7 +588,7 @@ PyObject *PyErr_SetExcFromWindowsErr(PyObject *exc, int ierr)
PyObject *PyErr_SetFromWindowsErr(int ierr)
{
- return PyErr_SetExcFromWindowsErrWithFilename(PyExc_WindowsError,
+ return PyErr_SetExcFromWindowsErrWithFilename(PyExc_OSError,
ierr, NULL);
}
PyObject *PyErr_SetFromWindowsErrWithFilename(
@@ -597,7 +597,7 @@ PyObject *PyErr_SetFromWindowsErrWithFilename(
{
PyObject *name = filename ? PyUnicode_DecodeFSDefault(filename) : NULL;
PyObject *result = PyErr_SetExcFromWindowsErrWithFilenameObject(
- PyExc_WindowsError,
+ PyExc_OSError,
ierr, name);
Py_XDECREF(name);
return result;
@@ -611,7 +611,7 @@ PyObject *PyErr_SetFromWindowsErrWithUnicodeFilename(
PyUnicode_FromUnicode(filename, wcslen(filename)) :
NULL;
PyObject *result = PyErr_SetExcFromWindowsErrWithFilenameObject(
- PyExc_WindowsError,
+ PyExc_OSError,
ierr, name);
Py_XDECREF(name);
return result;
@@ -798,7 +798,12 @@ PyErr_WriteUnraisable(PyObject *obj)
PyErr_Fetch(&t, &v, &tb);
f = PySys_GetObject("stderr");
if (f != NULL && f != Py_None) {
- PyFile_WriteString("Exception ", f);
+ if (obj) {
+ PyFile_WriteString("Exception ignored in: ", f);
+ PyFile_WriteObject(obj, f, 0);
+ PyFile_WriteString("\n", f);
+ }
+ PyTraceBack_Print(tb, f);
if (t) {
PyObject* moduleName;
char* className;
@@ -828,15 +833,11 @@ PyErr_WriteUnraisable(PyObject *obj)
PyFile_WriteString(className, f);
if (v && v != Py_None) {
PyFile_WriteString(": ", f);
- PyFile_WriteObject(v, f, 0);
+ PyFile_WriteObject(v, f, Py_PRINT_RAW);
}
+ PyFile_WriteString("\n", f);
Py_XDECREF(moduleName);
}
- if (obj) {
- PyFile_WriteString(" in ", f);
- PyFile_WriteObject(obj, f, 0);
- }
- PyFile_WriteString(" ignored\n", f);
PyErr_Clear(); /* Just in case */
}
Py_XDECREF(t);