summaryrefslogtreecommitdiffstats
path: root/Modules/cjkcodecs/cjkcodecs.h
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-07-25 11:34:49 (GMT)
committerGitHub <noreply@github.com>2023-07-25 11:34:49 (GMT)
commit329e4a1a3f8c53d9d120d2eed93b95a04b826f2f (patch)
tree8bbe3eb47cf37493fcd3289d98643605e0217c78 /Modules/cjkcodecs/cjkcodecs.h
parentf443b54a2f14e386a91fe4b09f41a265445008b8 (diff)
downloadcpython-329e4a1a3f8c53d9d120d2eed93b95a04b826f2f.zip
cpython-329e4a1a3f8c53d9d120d2eed93b95a04b826f2f.tar.gz
cpython-329e4a1a3f8c53d9d120d2eed93b95a04b826f2f.tar.bz2
gh-86493: Modernize modules initialization code (GH-106858)
Use PyModule_Add() or PyModule_AddObjectRef() instead of soft deprecated PyModule_AddObject().
Diffstat (limited to 'Modules/cjkcodecs/cjkcodecs.h')
-rw-r--r--Modules/cjkcodecs/cjkcodecs.h6
1 files changed, 1 insertions, 5 deletions
diff --git a/Modules/cjkcodecs/cjkcodecs.h b/Modules/cjkcodecs/cjkcodecs.h
index ee58878..766f829 100644
--- a/Modules/cjkcodecs/cjkcodecs.h
+++ b/Modules/cjkcodecs/cjkcodecs.h
@@ -398,11 +398,7 @@ register_maps(PyObject *module)
strcpy(mhname + sizeof("__map_") - 1, h->charset);
PyObject *capsule = PyCapsule_New((void *)h, MAP_CAPSULE, NULL);
- if (capsule == NULL) {
- return -1;
- }
- if (PyModule_AddObject(module, mhname, capsule) < 0) {
- Py_DECREF(capsule);
+ if (PyModule_Add(module, mhname, capsule) < 0) {
return -1;
}
}