summaryrefslogtreecommitdiff
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-10-21 17:10:42 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2016-10-21 17:10:42 +0300
commit14ab2776321525ac82d0ae170a5e1ab911c914c0 (patch)
treea740811e0c4169a523cf9c878927f72c3283d646 /Objects/unicodeobject.c
parentc4189a04a8d5fef512db33302f405c9e6170c369 (diff)
parent467ab194fc6189d9f7310c89937c51abeac56839 (diff)
downloadcpython-git-14ab2776321525ac82d0ae170a5e1ab911c914c0.tar.gz
Issue #28410: Added _PyErr_FormatFromCause() -- the helper for raising
new exception with setting current exception as __cause__. _PyErr_FormatFromCause(exception, format, args...) is equivalent to Python raise exception(format % args) from sys.exc_info()[1]
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index f92813cc07..05f4d30e08 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -3831,13 +3831,10 @@ PyUnicode_DecodeFSDefaultAndSize(const char *s, Py_ssize_t size)
Py_FileSystemDefaultEncodeErrors);
#ifdef MS_WINDOWS
if (!res && PyErr_ExceptionMatches(PyExc_UnicodeDecodeError)) {
- PyObject *exc, *val, *tb;
- PyErr_Fetch(&exc, &val, &tb);
- PyErr_Format(PyExc_RuntimeError,
- "filesystem path bytes were not correctly encoded with '%s'. " \
+ _PyErr_FormatFromCause(PyExc_RuntimeError,
+ "filesystem path bytes were not correctly encoded with '%s'. "
"Please report this at http://bugs.python.org/issue27781",
Py_FileSystemDefaultEncoding);
- _PyErr_ChainExceptions(exc, val, tb);
}
#endif
return res;