aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-02-07 09:17:07 +0100
committerGitHub <noreply@github.com>2020-02-07 09:17:07 +0100
commitd2ec81a8c99796b51fb8c49b77a7fe369863226f (patch)
treed88e7cbe89f65366d5591338fbe59a71192950db /Modules/sha256module.c
parentbpo-39573: Use Py_TYPE() macro in Modules directory (GH-18393) (diff)
downloadcpython-d2ec81a8c99796b51fb8c49b77a7fe369863226f.tar.gz
cpython-d2ec81a8c99796b51fb8c49b77a7fe369863226f.tar.bz2
cpython-d2ec81a8c99796b51fb8c49b77a7fe369863226f.zip
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/sha256module.c')
-rw-r--r--Modules/sha256module.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Modules/sha256module.c b/Modules/sha256module.c
index 245f4c04542..0e0c4461880 100644
--- a/Modules/sha256module.c
+++ b/Modules/sha256module.c
@@ -713,12 +713,14 @@ PyInit__sha256(void)
{
PyObject *m;
- Py_TYPE(&SHA224type) = &PyType_Type;
- if (PyType_Ready(&SHA224type) < 0)
+ Py_SET_TYPE(&SHA224type, &PyType_Type);
+ if (PyType_Ready(&SHA224type) < 0) {
return NULL;
- Py_TYPE(&SHA256type) = &PyType_Type;
- if (PyType_Ready(&SHA256type) < 0)
+ }
+ Py_SET_TYPE(&SHA256type, &PyType_Type);
+ if (PyType_Ready(&SHA256type) < 0) {
return NULL;
+ }
m = PyModule_Create(&_sha256module);
if (m == NULL)