summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2001-04-23 14:44:21 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2001-04-23 14:44:21 (GMT)
commit8155e0e54176c6f13067eb0e09ce5eb64c09afba (patch)
tree9e6f2658f29e58740c0f65366e000208996c73f0 /Doc
parent213c7a6aa5889f42495352199715a1c1a0833a00 (diff)
downloadcpython-8155e0e54176c6f13067eb0e09ce5eb64c09afba.zip
cpython-8155e0e54176c6f13067eb0e09ce5eb64c09afba.tar.gz
cpython-8155e0e54176c6f13067eb0e09ce5eb64c09afba.tar.bz2
This patch originated from an idea by Martin v. Loewis who submitted a
patch for sharing single character Unicode objects. Martin's patch had to be reworked in a number of ways to take Unicode resizing into consideration as well. Here's what the updated patch implements: * Single character Unicode strings in the Latin-1 range are shared (not only ASCII chars as in Martin's original patch). * The ASCII and Latin-1 codecs make use of this optimization, providing a noticable speedup for single character strings. Most Unicode methods can use the optimization as well (by virtue of using PyUnicode_FromUnicode()). * Some code cleanup was done (replacing memcpy with Py_UNICODE_COPY) * The PyUnicode_Resize() can now also handle the case of resizing unicode_empty which previously resulted in an error. * Modified the internal API _PyUnicode_Resize() and the public PyUnicode_Resize() API to handle references to shared objects correctly. The _PyUnicode_Resize() signature changed due to this. * Callers of PyUnicode_FromUnicode() may now only modify the Unicode object contents of the returned object in case they called the API with NULL as content template. Note that even though this patch passes the regression tests, there may still be subtle bugs in the sharing code.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/api/api.tex4
1 files changed, 3 insertions, 1 deletions
diff --git a/Doc/api/api.tex b/Doc/api/api.tex
index 58188b5..0d7f6f2 100644
--- a/Doc/api/api.tex
+++ b/Doc/api/api.tex
@@ -2457,7 +2457,9 @@ use these APIs:
Create a Unicode Object from the Py_UNICODE buffer \var{u} of the
given size. \var{u} may be \NULL{} which causes the contents to be
undefined. It is the user's responsibility to fill in the needed data.
-The buffer is copied into the new object.
+The buffer is copied into the new object. If the buffer is not \NULL{},
+the return value might be a shared object. Therefore, modification of
+the resulting Unicode Object is only allowed when \var{u} is \NULL{}.
\end{cfuncdesc}
\begin{cfuncdesc}{Py_UNICODE*}{PyUnicode_AsUnicode}{PyObject *unicode}