bpo-33803: Fix a crash in hamt.c (#7504)

This commit is contained in:
Yury Selivanov
2018-06-07 20:29:55 -04:00
committed by GitHub
parent c4f3cb772b
commit 378c53cc31
2 changed files with 4 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
Fix a crash in hamt.c caused by enabling GC tracking for an object that
hadn't all of its fields set to NULL.

View File

@@ -2476,6 +2476,8 @@ hamt_alloc(void)
if (o == NULL) { if (o == NULL) {
return NULL; return NULL;
} }
o->h_count = 0;
o->h_root = NULL;
o->h_weakreflist = NULL; o->h_weakreflist = NULL;
PyObject_GC_Track(o); PyObject_GC_Track(o);
return o; return o;