Files
cpython/Python
Victor Stinner d19febb00c Rework locale encoding C functions (#158680)
Add output_length to _Py_EncodeLocale(), _Py_EncodeUTF8(),
encode_current_locale() and encode_ascii(). So unicode_encode_locale() and
wstr_to_utf8() can now use the output_length, instead of having to compute
strlen().

* Rename functions:

  * _Py_DecodeUTF8Ex() => _Py_DecodeUTF8()
  * _Py_EncodeUTF8Ex() => _Py_EncodeUTF8()
  * _Py_EncodeLocaleEx() => _Py_EncodeLocale()
  * _Py_DecodeLocaleEx() => _Py_DecodeLocale()

* Add tests on Py_DecodeLocale() and Py_EncodeLocale() in test_codecs.
  Clarify also their documentation.
* _Py_EncodeLocale() and _Py_DecodeLocale() now sets all output parameters on
  error. Add more tests on these output parameters.
* Add encode_current_locale_impl() to simplify encode_current_locale().
* Remove reason parameter of _Py_EncodeLocale() and _Py_DecodeLocale() to
  simplify the code. Only the UTF-8 decoder used specific reasons.
* _Py_EncodeUTF8() now uses size_t instead of Py_ssize_t to iterate
  on the input string.
* On error, encode_current_locale_impl() now returns ENCODE_ERROR (new
  constant) instead of DECODE_ERROR.
* Mark _Py_EncodeLocaleRaw() as static (it's not used outside fileutils.c).
2026-10-04 23:22:18 +02:00
..
…

Miscellaneous source files for the main Python shared library