Special case the "s#" PyArg_Parse() token for Unicode objects:
authorMarc-André Lemburg <mal@egenix.com>
Thu, 21 Sep 2000 21:08:08 +0000 (21:08 +0000)
committerMarc-André Lemburg <mal@egenix.com>
Thu, 21 Sep 2000 21:08:08 +0000 (21:08 +0000)
"s#" will now return a pointer to the default encoded string data
of the Unicode object instead of a pointer to the raw UTF-16
data.

The latter is still available via PyObject_AsReadBuffer().

Doc/ext/ext.tex

index d54b78cac92c72a649541362439227de293f1578..38215fad66b494801defa00834b370dbf035e682 100644 (file)
@@ -692,10 +692,10 @@ raised.
 This variant on \samp{s} stores into two C variables, the first one a
 pointer to a character string, the second one its length.  In this
 case the Python string may contain embedded null bytes.  Unicode
-objects and all other read buffer compatible objects pass back a
-reference to the raw internal data representation. In case of Unicode
-objects the pointer points to a null-terminated buffer of 16-bit
-Py_UNICODE (UTF-16) data.
+objects pass back a pointer to the default encoded string version of the
+object if such a conversion is possible. All other read buffer
+compatible objects pass back a reference to the raw internal data
+representation.
 
 \item[\samp{z} (string or \code{None}) {[char *]}]
 Like \samp{s}, but the Python object may also be \code{None}, in which