diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-12 14:29:48 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-12 14:29:48 +0200 |
commit | e7ed9c7bd2204dd48d67eb7b14813c0338a85a0c (patch) | |
tree | fdcf7d7cba9df4da905bfc99dd42ddc7cfe15138 /Python/modsupport.c | |
parent | 4a994ab2dc58b8fd66549ea28eb489e8009d19d7 (diff) | |
parent | 5f7236d4e16f4f4eee4da97621a6f8a225dfba4e (diff) | |
download | cpython-e7ed9c7bd2204dd48d67eb7b14813c0338a85a0c.tar.gz |
Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
when decode astral characters.
Diffstat (limited to 'Python/modsupport.c')
-rw-r--r-- | Python/modsupport.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Python/modsupport.c b/Python/modsupport.c index 428914f378..6c938ddd79 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -161,7 +161,17 @@ do_mktuple(const char **p_format, va_list *p_va, int endchar, int n, int flags) /* Note that we can't bail immediately on error as this will leak refcounts on any 'N' arguments. */ for (i = 0; i < n; i++) { - PyObject *w = do_mkvalue(p_format, p_va, flags); + PyObject *w; + + if (itemfailed) { + PyObject *exception, *value, *tb; + PyErr_Fetch(&exception, &value, &tb); + w = do_mkvalue(p_format, p_va, flags); + PyErr_Restore(exception, value, tb); + } + else { + w = do_mkvalue(p_format, p_va, flags); + } if (w == NULL) { itemfailed = 1; Py_INCREF(Py_None); |