bpo-33803: Fix a crash in hamt.c (GH-7504) (GH-7505) · python/cpython@a971a6f (original) (raw)
File tree
2 files changed
lines changed
- Misc/NEWS.d/next/Core and Builtins
2 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1 | +Fix a crash in hamt.c caused by enabling GC tracking for an object that | |
2 | +hadn't all of its fields set to NULL. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2476,6 +2476,8 @@ hamt_alloc(void) | ||
2476 | 2476 | if (o == NULL) { |
2477 | 2477 | return NULL; |
2478 | 2478 | } |
2479 | +o->h_count = 0; | |
2480 | +o->h_root = NULL; | |
2479 | 2481 | o->h_weakreflist = NULL; |
2480 | 2482 | PyObject_GC_Track(o); |
2481 | 2483 | return o; |