File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -380,10 +380,14 @@ PYBIND11_NOINLINE inline void instance::allocate_layout() {
380380 space += tinfo->holder_size_in_ptrs ;
381381 }
382382
383- // Allocate space for flags, values, and holders:
383+ // Allocate space for flags, values, and holders; initialize the space to 0 (flags and
384+ // values need to be 0, and it doesn't hurt the holders)
385+ #if PY_VERSION_HEX >= 0x03050000
386+ values_and_holders = (void **) PyMem_Calloc (space, sizeof (void *));
387+ #else
384388 values_and_holders = (void **) PyMem_New (void *, space);
385- // flags and values need to start out equal to 0; it doesn't hurt the holders
386389 std::memset (values_and_holders, 0 , space * sizeof (void *));
390+ #endif
387391 }
388392 owned = true ;
389393}
You can’t perform that action at this time.
0 commit comments