summaryrefslogtreecommitdiff
path: root/Include/unicodeobject.h
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-07-15 16:13:05 +0300
committerBerker Peksag <berker.peksag@gmail.com>2016-07-15 16:13:05 +0300
commiteefb633becc8ba6ae7d30c04aaa01a5740b92cbb (patch)
tree6a8d976e7b8f8426f64f6b1aa848b24363e2490a /Include/unicodeobject.h
parent771fbd629810cb7dc48e10cc7d687b313c622fbf (diff)
parente30c0dfb84728e8c3f9e2f695b64071e53e1811b (diff)
downloadcpython-eefb633becc8ba6ae7d30c04aaa01a5740b92cbb.tar.gz
Issue #27518: Merge from 3.5
Diffstat (limited to 'Include/unicodeobject.h')
-rw-r--r--Include/unicodeobject.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 533dd75d2c..1af620d18d 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -900,7 +900,7 @@ typedef struct {
/* minimum character (default: 127, ASCII) */
Py_UCS4 min_char;
- /* If non-zero, overallocate the buffer by 25% (default: 0). */
+ /* If non-zero, overallocate the buffer (default: 0). */
unsigned char overallocate;
/* If readonly is 1, buffer is a shared string (cannot be modified)
@@ -934,6 +934,23 @@ PyAPI_FUNC(int)
_PyUnicodeWriter_PrepareInternal(_PyUnicodeWriter *writer,
Py_ssize_t length, Py_UCS4 maxchar);
+/* Prepare the buffer to have at least the kind KIND.
+ For example, kind=PyUnicode_2BYTE_KIND ensures that the writer will
+ support characters in range U+000-U+FFFF.
+
+ Return 0 on success, raise an exception and return -1 on error. */
+#define _PyUnicodeWriter_PrepareKind(WRITER, KIND) \
+ (assert((KIND) != PyUnicode_WCHAR_KIND), \
+ (KIND) <= (WRITER)->kind \
+ ? 0 \
+ : _PyUnicodeWriter_PrepareKindInternal((WRITER), (KIND)))
+
+/* Don't call this function directly, use the _PyUnicodeWriter_PrepareKind()
+ macro instead. */
+PyAPI_FUNC(int)
+_PyUnicodeWriter_PrepareKindInternal(_PyUnicodeWriter *writer,
+ enum PyUnicode_Kind kind);
+
/* Append a Unicode character.
Return 0 on success, raise an exception and return -1 on error. */
PyAPI_FUNC(int)
@@ -2253,6 +2270,10 @@ PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*);
/* Clear all static strings. */
PyAPI_FUNC(void) _PyUnicode_ClearStaticStrings(void);
+/* Fast equality check when the inputs are known to be exact unicode types
+ and where the hash values are equal (i.e. a very probable match) */
+PyAPI_FUNC(int) _PyUnicode_EQ(PyObject *, PyObject *);
+
#ifdef __cplusplus
}
#endif