mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
bpo-39573: Add Py_SET_TYPE() function (GH-18394)
Add Py_SET_TYPE() function to set the type of an object.
This commit is contained in:
parent
daa9756cb6
commit
d2ec81a8c9
24 changed files with 77 additions and 48 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue