@@ -660,7 +660,8 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal);
660660*/
661661
662662PyAPI_FUNC (PyObject * ) _PyUnicode_AsDefaultEncodedString (
663- PyObject * , const char * );
663+ PyObject * unicode ,
664+ const char * errors );
664665
665666/* Decode a null-terminated string using Py_FileSystemDefaultEncoding.
666667
@@ -681,26 +682,36 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeFSDefaultAndSize(
681682 Py_ssize_t size /* size */
682683 );
683684
685+ /* Returns a pointer to the default encoding (normally, UTF-8) of the
686+ Unicode object unicode and the size of the encoded representation
687+ in bytes stored in *size.
684688
685- /* Return a char* holding the UTF-8 encoded value of the
686- Unicode object.
689+ In case of an error, no *size is set.
687690
688- DEPRECATED: use PyUnicode_AsStringAndSize() instead.
689691*/
690692
691- PyAPI_FUNC (char * ) PyUnicode_AsStringAndSize (PyObject * , Py_ssize_t * );
693+ PyAPI_FUNC (char * ) PyUnicode_AsStringAndSize (
694+ PyObject * unicode ,
695+ Py_ssize_t * size );
692696
693- /* Returns the UTF-8 encoding, and its size.
697+ /* Returns a pointer to the default encoding (normally, UTf-8) of the
698+ Unicode object unicode.
694699
695- If the output argument is NULL, no size is stored.
696- */
700+ Use of this API is DEPRECATED since no size information can be
701+ extracted from the returned data. Use PyUnicode_AsStringAndSize()
702+ instead.
697703
698- PyAPI_FUNC ( char * ) PyUnicode_AsString ( PyObject * );
704+ */
699705
700- /* Returns the UTF-8 encoding.
706+ PyAPI_FUNC ( char * ) PyUnicode_AsString ( PyObject * unicode );
701707
702- This is equivalent to PyUnicode_AsStringAndSize(x, NULL) .
708+ /* Returns the currently active default encoding .
703709
710+ The default encoding is currently implemented as run-time settable
711+ process global. This may change in future versions of the
712+ interpreter to become a parameter which is managed on a per-thread
713+ basis.
714+
704715 */
705716
706717PyAPI_FUNC (const char * ) PyUnicode_GetDefaultEncoding (void );
0 commit comments