summaryrefslogtreecommitdiffstats
path: root/Modules/_heapqmodule.c
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/_heapqmodule.c
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/_heapqmodule.c')
-rw-r--r--Modules/_heapqmodule.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c
index 00285ae..9d4ec25 100644
--- a/Modules/_heapqmodule.c
+++ b/Modules/_heapqmodule.c
@@ -672,9 +672,7 @@ From all times, sorting has always been a Great Art! :-)\n");
static int
heapq_exec(PyObject *m)
{
- PyObject *about = PyUnicode_FromString(__about__);
- if (PyModule_AddObject(m, "__about__", about) < 0) {
- Py_DECREF(about);
+ if (PyModule_Add(m, "__about__", PyUnicode_FromString(__about__)) < 0) {
return -1;
}
return 0;