]> granicus.if.org Git - python/commit
bpo-34523: Support surrogatepass in locale codecs (GH-8995)
authorVictor Stinner <vstinner@redhat.com>
Wed, 29 Aug 2018 20:21:32 +0000 (22:21 +0200)
committerGitHub <noreply@github.com>
Wed, 29 Aug 2018 20:21:32 +0000 (22:21 +0200)
commit3d4226a832cabc630402589cc671cc4035d504e5
treea1c5b1c51cbbca3aedd52593c979a5c15d72dd52
parentc5989cd87659acbfd4d19dc00dbe99c3a0fc9bd2
bpo-34523: Support surrogatepass in locale codecs (GH-8995)

Add support for the "surrogatepass" error handler in
PyUnicode_DecodeFSDefault() and PyUnicode_EncodeFSDefault()
for the UTF-8 encoding.

Changes:

* _Py_DecodeUTF8Ex() and _Py_EncodeUTF8Ex() now support the
  surrogatepass error handler (_Py_ERROR_SURROGATEPASS).
* _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx() now use
  the _Py_error_handler enum instead of "int surrogateescape" to pass
  the error handler. These functions now return -3 if the error
  handler is unknown.
* Add unit tests on _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx()
  in test_codecs.
* Rename get_error_handler() to _Py_GetErrorHandler() and expose it
  as a private function.
* _freeze_importlib doesn't need config.filesystem_errors="strict"
  workaround anymore.
Include/fileutils.h
Lib/test/test_codecs.py
Modules/_testcapimodule.c
Objects/stringlib/codecs.h
Objects/unicodeobject.c
Programs/_freeze_importlib.c
Python/fileutils.c