[Python-checkins] r80661 - in python/branches/py3k: Misc/NEWS Objects/unicodeobject.c
victor.stinner
python-checkins at python.org
Fri Apr 30 18:37:52 CEST 2010
Author: victor.stinner
Date: Fri Apr 30 18:37:52 2010
New Revision: 80661
Log:
PyUnicode_DecodeFSDefaultAndSize() uses surrogateescape error handler
This function is only used to decode Python module filenames, but Python
doesn't support surrogates in modules filenames yet. So nobody noticed this
minor bug.
Modified:
python/branches/py3k/Misc/NEWS
python/branches/py3k/Objects/unicodeobject.c
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Fri Apr 30 18:37:52 2010
@@ -12,6 +12,8 @@
Core and Builtins
-----------------
+- PyUnicode_DecodeFSDefaultAndSize() uses surrogateescape error handler
+
- Issue #8419: Prevent the dict constructor from accepting non-string keyword
arguments.
Modified: python/branches/py3k/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k/Objects/unicodeobject.c (original)
+++ python/branches/py3k/Objects/unicodeobject.c Fri Apr 30 18:37:52 2010
@@ -1600,19 +1600,19 @@
if (Py_FileSystemDefaultEncoding) {
#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
if (strcmp(Py_FileSystemDefaultEncoding, "mbcs") == 0) {
- return PyUnicode_DecodeMBCS(s, size, "replace");
+ return PyUnicode_DecodeMBCS(s, size, "surrogateescape");
}
#elif defined(__APPLE__)
if (strcmp(Py_FileSystemDefaultEncoding, "utf-8") == 0) {
- return PyUnicode_DecodeUTF8(s, size, "replace");
+ return PyUnicode_DecodeUTF8(s, size, "surrogateescape");
}
#endif
return PyUnicode_Decode(s, size,
Py_FileSystemDefaultEncoding,
- "replace");
+ "surrogateescape");
}
else {
- return PyUnicode_DecodeUTF8(s, size, "replace");
+ return PyUnicode_DecodeUTF8(s, size, "surrogateescape");
}
}
More information about the Python-checkins
mailing list