summaryrefslogtreecommitdiff
path: root/Modules/clinic/_codecsmodule.c.h
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2020-10-25 06:06:13 +0000
committerGitHub <noreply@github.com>2020-10-25 06:06:13 +0000
commitb1c9a20f5d8961a5b1555cf68eb38afafb39e1d7 (patch)
treee5c3a1f5cddec8c49c94647d300a7ca2e76f191a /Modules/clinic/_codecsmodule.c.h
parent4a9c6379380defd37b5483607d0d804db18f7812 (diff)
downloadcpython-git-revert-22513-update_test_codecs.tar.gz
Revert "bpo-41919, test_codecs: Move codecs.register calls to setUp() (GH-22513)"revert-22513-update_test_codecs
This reverts commit c9f696cb96d1c362d5cad871f61da520572d9b08.
Diffstat (limited to 'Modules/clinic/_codecsmodule.c.h')
-rw-r--r--Modules/clinic/_codecsmodule.c.h39
1 files changed, 38 insertions, 1 deletions
diff --git a/Modules/clinic/_codecsmodule.c.h b/Modules/clinic/_codecsmodule.c.h
index 43378f94f9..e2ebb68612 100644
--- a/Modules/clinic/_codecsmodule.c.h
+++ b/Modules/clinic/_codecsmodule.c.h
@@ -217,6 +217,43 @@ exit:
return return_value;
}
+PyDoc_STRVAR(_codecs__forget_codec__doc__,
+"_forget_codec($module, encoding, /)\n"
+"--\n"
+"\n"
+"Purge the named codec from the internal codec lookup cache");
+
+#define _CODECS__FORGET_CODEC_METHODDEF \
+ {"_forget_codec", (PyCFunction)_codecs__forget_codec, METH_O, _codecs__forget_codec__doc__},
+
+static PyObject *
+_codecs__forget_codec_impl(PyObject *module, const char *encoding);
+
+static PyObject *
+_codecs__forget_codec(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *encoding;
+
+ if (!PyUnicode_Check(arg)) {
+ _PyArg_BadArgument("_forget_codec", "argument", "str", arg);
+ goto exit;
+ }
+ Py_ssize_t encoding_length;
+ encoding = PyUnicode_AsUTF8AndSize(arg, &encoding_length);
+ if (encoding == NULL) {
+ goto exit;
+ }
+ if (strlen(encoding) != (size_t)encoding_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+ return_value = _codecs__forget_codec_impl(module, encoding);
+
+exit:
+ return return_value;
+}
+
PyDoc_STRVAR(_codecs_escape_decode__doc__,
"escape_decode($module, data, errors=None, /)\n"
"--\n"
@@ -2801,4 +2838,4 @@ exit:
#ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF
#define _CODECS_CODE_PAGE_ENCODE_METHODDEF
#endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */
-/*[clinic end generated code: output=557c3b37e4c492ac input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9a97e2ddf3e69072 input=a9049054013a1b77]*/