[Python-checkins] r68590 - python/branches/py3k/Doc/c-api/unicode.rst

benjamin.peterson python-checkins at python.org
Wed Jan 14 00:14:04 CET 2009


Author: benjamin.peterson
Date: Wed Jan 14 00:14:04 2009
New Revision: 68590

Log:
encoding returns bytes objects

Modified:
   python/branches/py3k/Doc/c-api/unicode.rst

Modified: python/branches/py3k/Doc/c-api/unicode.rst
==============================================================================
--- python/branches/py3k/Doc/c-api/unicode.rst	(original)
+++ python/branches/py3k/Doc/c-api/unicode.rst	Wed Jan 14 00:14:04 2009
@@ -409,19 +409,19 @@
 .. cfunction:: PyObject* PyUnicode_Encode(const Py_UNICODE *s, Py_ssize_t size, const char *encoding, const char *errors)
 
    Encode the :ctype:`Py_UNICODE` buffer of the given size and return a Python
-   string object.  *encoding* and *errors* have the same meaning as the parameters
-   of the same name in the Unicode :meth:`encode` method.  The codec to be used is
-   looked up using the Python codec registry.  Return *NULL* if an exception was
-   raised by the codec.
+   bytes object.  *encoding* and *errors* have the same meaning as the
+   parameters of the same name in the Unicode :meth:`encode` method.  The codec
+   to be used is looked up using the Python codec registry.  Return *NULL* if an
+   exception was raised by the codec.
 
 
 .. cfunction:: PyObject* PyUnicode_AsEncodedString(PyObject *unicode, const char *encoding, const char *errors)
 
-   Encode a Unicode object and return the result as Python string object.
-   *encoding* and *errors* have the same meaning as the parameters of the same name
-   in the Unicode :meth:`encode` method. The codec to be used is looked up using
-   the Python codec registry. Return *NULL* if an exception was raised by the
-   codec.
+   Encode a Unicode object and return the result as Python bytes object.
+   *encoding* and *errors* have the same meaning as the parameters of the same
+   name in the Unicode :meth:`encode` method. The codec to be used is looked up
+   using the Python codec registry. Return *NULL* if an exception was raised by
+   the codec.
 
 These are the UTF-8 codec APIs:
 
@@ -444,15 +444,16 @@
 
 .. cfunction:: PyObject* PyUnicode_EncodeUTF8(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
 
-   Encode the :ctype:`Py_UNICODE` buffer of the given size using UTF-8 and return a
-   Python string object.  Return *NULL* if an exception was raised by the codec.
+   Encode the :ctype:`Py_UNICODE` buffer of the given size using UTF-8 and
+   return a Python bytes object.  Return *NULL* if an exception was raised by
+   the codec.
 
 
 .. cfunction:: PyObject* PyUnicode_AsUTF8String(PyObject *unicode)
 
-   Encode a Unicode object using UTF-8 and return the result as Python string
-   object.  Error handling is "strict".  Return *NULL* if an exception was raised
-   by the codec.
+   Encode a Unicode object using UTF-8 and return the result as Python bytes
+   object.  Error handling is "strict".  Return *NULL* if an exception was
+   raised by the codec.
 
 These are the UTF-32 codec APIs:
 
@@ -514,9 +515,9 @@
 
 .. cfunction:: PyObject* PyUnicode_AsUTF32String(PyObject *unicode)
 
-   Return a Python string using the UTF-32 encoding in native byte order. The
-   string always starts with a BOM mark.  Error handling is "strict".  Return
-   *NULL* if an exception was raised by the codec.
+   Return a Python byte string using the UTF-32 encoding in native byte
+   order. The string always starts with a BOM mark.  Error handling is "strict".
+   Return *NULL* if an exception was raised by the codec.
 
 
 These are the UTF-16 codec APIs:
@@ -558,7 +559,7 @@
 
 .. cfunction:: PyObject* PyUnicode_EncodeUTF16(const Py_UNICODE *s, Py_ssize_t size, const char *errors, int byteorder)
 
-   Return a Python string object holding the UTF-16 encoded value of the Unicode
+   Return a Python bytes object holding the UTF-16 encoded value of the Unicode
    data in *s*.  If *byteorder* is not ``0``, output is written according to the
    following byte order::
 
@@ -578,9 +579,9 @@
 
 .. cfunction:: PyObject* PyUnicode_AsUTF16String(PyObject *unicode)
 
-   Return a Python string using the UTF-16 encoding in native byte order. The
-   string always starts with a BOM mark.  Error handling is "strict".  Return
-   *NULL* if an exception was raised by the codec.
+   Return a Python byte string using the UTF-16 encoding in native byte
+   order. The string always starts with a BOM mark.  Error handling is "strict".
+   Return *NULL* if an exception was raised by the codec.
 
 These are the "Unicode Escape" codec APIs:
 
@@ -644,15 +645,16 @@
 
 .. cfunction:: PyObject* PyUnicode_EncodeLatin1(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
 
-   Encode the :ctype:`Py_UNICODE` buffer of the given size using Latin-1 and return
-   a Python string object.  Return *NULL* if an exception was raised by the codec.
+   Encode the :ctype:`Py_UNICODE` buffer of the given size using Latin-1 and
+   return a Python bytes object.  Return *NULL* if an exception was raised by
+   the codec.
 
 
 .. cfunction:: PyObject* PyUnicode_AsLatin1String(PyObject *unicode)
 
-   Encode a Unicode object using Latin-1 and return the result as Python string
-   object.  Error handling is "strict".  Return *NULL* if an exception was raised
-   by the codec.
+   Encode a Unicode object using Latin-1 and return the result as Python bytes
+   object.  Error handling is "strict".  Return *NULL* if an exception was
+   raised by the codec.
 
 These are the ASCII codec APIs.  Only 7-bit ASCII data is accepted. All other
 codes generate errors.
@@ -668,15 +670,16 @@
 
 .. cfunction:: PyObject* PyUnicode_EncodeASCII(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
 
-   Encode the :ctype:`Py_UNICODE` buffer of the given size using ASCII and return a
-   Python string object.  Return *NULL* if an exception was raised by the codec.
+   Encode the :ctype:`Py_UNICODE` buffer of the given size using ASCII and
+   return a Python bytes object.  Return *NULL* if an exception was raised by
+   the codec.
 
 
 .. cfunction:: PyObject* PyUnicode_AsASCIIString(PyObject *unicode)
 
-   Encode a Unicode object using ASCII and return the result as Python string
-   object.  Error handling is "strict".  Return *NULL* if an exception was raised
-   by the codec.
+   Encode a Unicode object using ASCII and return the result as Python bytes
+   object.  Error handling is "strict".  Return *NULL* if an exception was
+   raised by the codec.
 
 These are the mapping codec APIs:
 
@@ -767,15 +770,16 @@
 
 .. cfunction:: PyObject* PyUnicode_EncodeMBCS(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
 
-   Encode the :ctype:`Py_UNICODE` buffer of the given size using MBCS and return a
-   Python string object.  Return *NULL* if an exception was raised by the codec.
+   Encode the :ctype:`Py_UNICODE` buffer of the given size using MBCS and return
+   a Python bytes object.  Return *NULL* if an exception was raised by the
+   codec.
 
 
 .. cfunction:: PyObject* PyUnicode_AsMBCSString(PyObject *unicode)
 
-   Encode a Unicode object using MBCS and return the result as Python string
-   object.  Error handling is "strict".  Return *NULL* if an exception was raised
-   by the codec.
+   Encode a Unicode object using MBCS and return the result as Python bytes
+   object.  Error handling is "strict".  Return *NULL* if an exception was
+   raised by the codec.
 
 .. % --- Methods & Slots ----------------------------------------------------
 


More information about the Python-checkins mailing list