summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-08-26 21:35:06 (GMT)
committerGitHub <noreply@github.com>2023-08-26 21:35:06 (GMT)
commit2b15536fa94d07e9e286826c23507402313ec7f4 (patch)
treebed59616b5e2b833e15cc6b10f0dccfca8faa9fb /Objects/unicodeobject.c
parente407cea1938b80b1d469f148a4ea65587820e3eb (diff)
downloadcpython-2b15536fa94d07e9e286826c23507402313ec7f4.zip
cpython-2b15536fa94d07e9e286826c23507402313ec7f4.tar.gz
cpython-2b15536fa94d07e9e286826c23507402313ec7f4.tar.bz2
gh-107913: Fix possible losses of OSError error codes (GH-107930)
Functions like PyErr_SetFromErrno() and SetFromWindowsErr() should be called immediately after using the C API which sets errno or the Windows error code.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 2f6f413..045b48c 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -7101,7 +7101,7 @@ decode_code_page_errors(UINT code_page,
if (err != ERROR_NO_UNICODE_TRANSLATION
&& err != ERROR_INSUFFICIENT_BUFFER)
{
- PyErr_SetFromWindowsErr(0);
+ PyErr_SetFromWindowsErr(err);
goto error;
}
insize++;