summaryrefslogtreecommitdiffstats
path: root/Modules/md5module.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-02-07 08:17:07 (GMT)
committerGitHub <noreply@github.com>2020-02-07 08:17:07 (GMT)
commitd2ec81a8c99796b51fb8c49b77a7fe369863226f (patch)
treed88e7cbe89f65366d5591338fbe59a71192950db /Modules/md5module.c
parentdaa9756cb6395323d6f291efe5c7d7fdc6b2e9d8 (diff)
downloadcpython-d2ec81a8c99796b51fb8c49b77a7fe369863226f.zip
cpython-d2ec81a8c99796b51fb8c49b77a7fe369863226f.tar.gz
cpython-d2ec81a8c99796b51fb8c49b77a7fe369863226f.tar.bz2
bpo-39573: Add Py_SET_TYPE() function (GH-18394)
Add Py_SET_TYPE() function to set the type of an object.
Diffstat (limited to 'Modules/md5module.c')
-rw-r--r--Modules/md5module.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/md5module.c b/Modules/md5module.c
index f2c2d32..d783ae5 100644
--- a/Modules/md5module.c
+++ b/Modules/md5module.c
@@ -572,13 +572,15 @@ PyInit__md5(void)
{
PyObject *m;
- Py_TYPE(&MD5type) = &PyType_Type;
- if (PyType_Ready(&MD5type) < 0)
+ Py_SET_TYPE(&MD5type, &PyType_Type);
+ if (PyType_Ready(&MD5type) < 0) {
return NULL;
+ }
m = PyModule_Create(&_md5module);
- if (m == NULL)
+ if (m == NULL) {
return NULL;
+ }
Py_INCREF((PyObject *)&MD5type);
PyModule_AddObject(m, "MD5Type", (PyObject *)&MD5type);