There was an error while loading. Please reload this page.
1 parent edbd446 commit 13d31feCopy full SHA for 13d31fe
1 file changed
Modules/hmacmodule.c
@@ -734,7 +734,9 @@ has_uint32_t_buffer_length(const Py_buffer *buffer)
734
static HMACObject *
735
hmac_new_object(PyTypeObject *tp)
736
{
737
- HMACObject *self = (HMACObject *)tp->tp_alloc(tp, 0);
+ // Using tp_alloc on GC objects automatically tracks them,
738
+ // but we need to first set the fields appropriately.
739
+ HMACObject *self = PyObject_GC_New(HMACObject, tp);
740
if (self == NULL) {
741
return NULL;
742
}
0 commit comments