summaryrefslogtreecommitdiffstats
path: root/Include/unicodeobject.h
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-29 13:53:23 (GMT)
committerGuido van Rossum <guido@python.org>2007-08-29 13:53:23 (GMT)
commit7d1df6c9b1a7e075c03c4790f47bc83e0104579f (patch)
tree6dceba59593ca682c88dd1a699fec2fc51f78129 /Include/unicodeobject.h
parent9befa93b04ee0c485615d87e4b34dcfe5e811194 (diff)
downloadcpython-7d1df6c9b1a7e075c03c4790f47bc83e0104579f.zip
cpython-7d1df6c9b1a7e075c03c4790f47bc83e0104579f.tar.gz
cpython-7d1df6c9b1a7e075c03c4790f47bc83e0104579f.tar.bz2
Add PyUnicode_AsStringAndSize(), which is like PyUnicode_AsString() but
has an extra (optional) output parameter through which it returns the size. Use this in a few places where I used PyUnicode_AsString() + strlen(), and in one new place (which fixes test_pep263).
Diffstat (limited to 'Include/unicodeobject.h')
-rw-r--r--Include/unicodeobject.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 4d8e45a..4374857 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -641,20 +641,25 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal);
PyAPI_FUNC(PyObject *) _PyUnicode_AsDefaultEncodedString(
PyObject *, const char *);
-/* Return a char* holding the default encoded value of the
- Unicode object.
+/* Return a char* holding the UTF-8 encoded value of the
+ Unicode object.
+
+ DEPRECATED: use PyUnicode_AsStringAndSize() instead.
*/
+PyAPI_FUNC(char *) PyUnicode_AsStringAndSize(PyObject*, Py_ssize_t *);
+
+/* Returns the UTF-8 encoding, and its size.
+
+ If the output argument is NULL, no size is stored.
+ */
+
PyAPI_FUNC(char *) PyUnicode_AsString(PyObject*);
+/* Returns the UTF-8 encoding.
-/* Returns the currently active default encoding.
+ This is equivalent to PyUnicode_AsStringAndSize(x, NULL).
- The default encoding is currently implemented as run-time settable
- process global. This may change in future versions of the
- interpreter to become a parameter which is managed on a per-thread
- basis.
-
*/
PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void);