summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
diff options
context:
space:
mode:
authorMax Bélanger <aeromax@gmail.com>2018-11-04 23:58:24 (GMT)
committerBenjamin Peterson <benjamin@python.org>2018-11-04 23:58:24 (GMT)
commit2810dd7be9876236f74ac80716d113572c9098dd (patch)
tree796f4fed255575ae6ad652b01750903e3857e125 /Modules/clinic
parent5d236cafd7126e640fb25541fcc7e0a494450143 (diff)
downloadcpython-2810dd7be9876236f74ac80716d113572c9098dd.zip
cpython-2810dd7be9876236f74ac80716d113572c9098dd.tar.gz
cpython-2810dd7be9876236f74ac80716d113572c9098dd.tar.bz2
closes bpo-32285: Add unicodedata.is_normalized. (GH-4806)
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/unicodedata.c.h40
1 files changed, 36 insertions, 4 deletions
diff --git a/Modules/clinic/unicodedata.c.h b/Modules/clinic/unicodedata.c.h
index 72e3f65..54021fe 100644
--- a/Modules/clinic/unicodedata.c.h
+++ b/Modules/clinic/unicodedata.c.h
@@ -284,6 +284,38 @@ exit:
return return_value;
}
+PyDoc_STRVAR(unicodedata_UCD_is_normalized__doc__,
+"is_normalized($self, form, unistr, /)\n"
+"--\n"
+"\n"
+"Return whether the Unicode string unistr is in the normal form \'form\'.\n"
+"\n"
+"Valid values for form are \'NFC\', \'NFKC\', \'NFD\', and \'NFKD\'.");
+
+#define UNICODEDATA_UCD_IS_NORMALIZED_METHODDEF \
+ {"is_normalized", (PyCFunction)unicodedata_UCD_is_normalized, METH_FASTCALL, unicodedata_UCD_is_normalized__doc__},
+
+static PyObject *
+unicodedata_UCD_is_normalized_impl(PyObject *self, PyObject *form,
+ PyObject *input);
+
+static PyObject *
+unicodedata_UCD_is_normalized(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ PyObject *form;
+ PyObject *input;
+
+ if (!_PyArg_ParseStack(args, nargs, "UU:is_normalized",
+ &form, &input)) {
+ goto exit;
+ }
+ return_value = unicodedata_UCD_is_normalized_impl(self, form, input);
+
+exit:
+ return return_value;
+}
+
PyDoc_STRVAR(unicodedata_UCD_normalize__doc__,
"normalize($self, form, unistr, /)\n"
"--\n"
@@ -296,17 +328,17 @@ PyDoc_STRVAR(unicodedata_UCD_normalize__doc__,
{"normalize", (PyCFunction)unicodedata_UCD_normalize, METH_FASTCALL, unicodedata_UCD_normalize__doc__},
static PyObject *
-unicodedata_UCD_normalize_impl(PyObject *self, const char *form,
+unicodedata_UCD_normalize_impl(PyObject *self, PyObject *form,
PyObject *input);
static PyObject *
unicodedata_UCD_normalize(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
- const char *form;
+ PyObject *form;
PyObject *input;
- if (!_PyArg_ParseStack(args, nargs, "sU:normalize",
+ if (!_PyArg_ParseStack(args, nargs, "UU:normalize",
&form, &input)) {
goto exit;
}
@@ -379,4 +411,4 @@ unicodedata_UCD_lookup(PyObject *self, PyObject *arg)
exit:
return return_value;
}
-/*[clinic end generated code: output=dc899bff0ecd14c1 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=2c5fbf597c18f6b8 input=a9049054013a1b77]*/