mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
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:
parent
cf693e537d
commit
c9f696cb96
7 changed files with 16 additions and 112 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue