
Le lun. 29 juin 2020 à 08:41, Inada Naoki <songofacandy@gmail.com> a écrit :
That's all. Now I think it is safe to override deprecated APIs with private APIs accepts Unicode Object.
* _PyUnicode_EncodeUTF7 -> PyUnicode_EncodeUTF7
Use PyUnicode_AsEncodedString("UTF-7"). This encoding is not common enough to justify to have to maintain a public C API for just it. Adding public C API functions have a cost in CPython, but also in other Python implementations which then have to maintain it as well. The C API is too large, we have to make it smaller, not larger.
* _PyUnicode_AsUTF8String -> PyUnicode_EncodeUTF8
Use PyUnicode_AsUTF8String(), or PyUnicode_AsEncodedString() if you need to pass errors.
* _PyUnicode_EncodeUTF16 -> PyUnicode_EncodeUTF16
Use PyUnicode_AsUTF16String(), or PyUnicode_AsEncodedString() if you need to pass errors or the byte order.
* _PyUnicode_EncodeUTF32 -> PyUnicode_EncodeUTF32
Who use UTF32? There is PyUnicode_AsUTF32String().
* _PyUnicode_AsLatin1String -> PyUnicode_EncodeLatin1
PyUnicode_AsLatin1String()
* _PyUnicode_AsASCIIString -> PyUnicode_EncodeASCII
PyUnicode_AsASCIIString()
* _PyUnicode_EncodeCharmap -> PyUnicode_EncodeCharmap
PyUnicode_AsCharmapString() Victor -- Night gathers, and now my watch begins. It shall not end until my death.