Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e0f3268

Browse files
author
Victor Stinner
committed
run_file(): encode the filename with PyUnicode_EncodeFSDefault() instead of
PyUnicode_AsUTF8String()
1 parent c049982 commit e0f3268

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Modules/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,14 @@ run_file(FILE *fp, const wchar_t *filename, PyCompilerFlags *p_cf)
280280
if (filename) {
281281
unicode = PyUnicode_FromWideChar(filename, wcslen(filename));
282282
if (unicode != NULL) {
283-
bytes = PyUnicode_AsUTF8String(unicode);
283+
bytes = PyUnicode_EncodeFSDefault(unicode);
284284
Py_DECREF(unicode);
285285
}
286286
if (bytes != NULL)
287287
filename_str = PyBytes_AsString(bytes);
288288
else {
289289
PyErr_Clear();
290-
filename_str = "<decoding error>";
290+
filename_str = "<encoding error>";
291291
}
292292
}
293293
else

0 commit comments

Comments
 (0)