Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix refcounts.
  • Loading branch information
ericsnowcurrently committed Nov 11, 2022
commit 68076f5a1864fae14ed136e30aa4ca06e653d0fb
4 changes: 2 additions & 2 deletions Python/hamt.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ hamt_node_bitmap_new(Py_ssize_t size)
/* Since bitmap nodes are immutable, we can cache the instance
for size=0 and reuse it whenever we need an empty bitmap node.
*/
return (PyHamtNode *)&_Py_SINGLETON(hamt_bitmap_node_empty);
return (PyHamtNode *)Py_NewRef(&_Py_SINGLETON(hamt_bitmap_node_empty));
}

assert(size >= 0);
Expand Down Expand Up @@ -2434,7 +2434,7 @@ _PyHamt_New(void)
{
/* HAMT is an immutable object so we can easily cache an
empty instance. */
return (PyHamtObject*)_empty_hamt;
return (PyHamtObject*)Py_NewRef(_empty_hamt);
}

#ifdef Py_DEBUG
Expand Down