This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Make _PyUnicode_AsString as public API
Type: enhancement Stage:
Components: Documentation, Extension Modules, Interpreter Core, Unicode Versions: Python 3.1, Python 3.2
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: benjamin.peterson, bhy, georg.brandl
Priority: normal Keywords:

Created on 2009-06-06 17:11 by bhy, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg89007 - (view) Author: Haoyu Bai (bhy) Date: 2009-06-06 17:11
Why _PyUnicode_AsString and _PyUnicode_AsStringAndSize are not public
API? They are very useful when porting extension module to Python 3,
because they have the semantic as same as PyString_AsString. For
extension author, these API can be used for replacing PyString_AsString
without any other change in code logic.

So why not make these API public? Any consideration? If we can document
these API, then C extension author can know them and use them, without
spending a lot of time to dig them out from Python source code.

Thanks!
msg89008 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-06-06 17:25
They are not public because implicitly encoding unicode is bad practice
in Python 3. You should use PyUnicode_AsEncodedString() or such.
History
Date User Action Args
2022-04-11 14:56:49adminsetgithub: 50472
2009-06-06 17:25:59benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg89008

resolution: rejected
2009-06-06 17:11:03bhycreate