bpo-41919, test_codecs: Move codecs.register calls to setUp() (GH-22513)

* Move the codecs' (un)register operation to testcases.
* Remove _codecs._forget_codec() and _PyCodec_Forget()
This commit is contained in:
Hai Shi 2020-10-16 16:34:15 +08:00 committed by GitHub
parent cf693e537d
commit c9f696cb96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 112 deletions

View file

@ -208,31 +208,6 @@ PyObject *_PyCodec_Lookup(const char *encoding)
return NULL;
}
int _PyCodec_Forget(const char *encoding)
{
PyObject *v;
int result;
PyInterpreterState *interp = _PyInterpreterState_GET();
if (interp->codec_search_path == NULL) {
return -1;
}
/* Convert the encoding to a normalized Python string: all
characters are converted to lower case, spaces and hyphens are
replaced with underscores. */
v = normalizestring(encoding);
if (v == NULL) {
return -1;
}
/* Drop the named codec from the internal cache */
result = PyDict_DelItem(interp->codec_search_cache, v);
Py_DECREF(v);
return result;
}
/* Codec registry encoding check API. */
int PyCodec_KnownEncoding(const char *encoding)