summaryrefslogtreecommitdiffstats
path: root/Python/codecs.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-10-26 18:19:36 (GMT)
committerGitHub <noreply@github.com>2020-10-26 18:19:36 (GMT)
commit920cb647ba23feab7987d0dac1bd63bfc2ffc4c0 (patch)
tree9ce3f058110f5fef8469d7a4421adc7d66fe85a8 /Python/codecs.c
parent8374d2ee1589791be8892b00f4bbf8121dde24bd (diff)
downloadcpython-920cb647ba23feab7987d0dac1bd63bfc2ffc4c0.zip
cpython-920cb647ba23feab7987d0dac1bd63bfc2ffc4c0.tar.gz
cpython-920cb647ba23feab7987d0dac1bd63bfc2ffc4c0.tar.bz2
bpo-42157: unicodedata avoids references to UCD_Type (GH-22990)
* UCD_Check() uses PyModule_Check() * Simplify the internal _PyUnicode_Name_CAPI structure: * Remove size and state members * Remove state and self parameters of getcode() and getname() functions * Remove global_module_state
Diffstat (limited to 'Python/codecs.c')
-rw-r--r--Python/codecs.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/codecs.c b/Python/codecs.c
index 62d1f3f..fa329ce 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -987,8 +987,7 @@ PyObject *PyCodec_NameReplaceErrors(PyObject *exc)
for (i = start, ressize = 0; i < end; ++i) {
/* object is guaranteed to be "ready" */
c = PyUnicode_READ_CHAR(object, i);
- if (ucnhash_capi->getname(ucnhash_capi->state, NULL,
- c, buffer, sizeof(buffer), 1)) {
+ if (ucnhash_capi->getname(c, buffer, sizeof(buffer), 1)) {
replsize = 1+1+1+(int)strlen(buffer)+1;
}
else if (c >= 0x10000) {
@@ -1011,8 +1010,7 @@ PyObject *PyCodec_NameReplaceErrors(PyObject *exc)
i < end; ++i) {
c = PyUnicode_READ_CHAR(object, i);
*outp++ = '\\';
- if (ucnhash_capi->getname(ucnhash_capi->state, NULL,
- c, buffer, sizeof(buffer), 1)) {
+ if (ucnhash_capi->getname(c, buffer, sizeof(buffer), 1)) {
*outp++ = 'N';
*outp++ = '{';
strcpy((char *)outp, buffer);