8000 Update numpy/core/src/multiarray/alloc.c · numpy/numpy@129340f · GitHub
[go: up one dir, main page]

Skip to content

Commit 129340f

Browse files
eendebakptseberg
andauthored
Update numpy/core/src/multiarray/alloc.c
Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
1 parent 81aa86e commit 129340f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

numpy/core/src/multiarray/alloc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,11 @@ PyDataMem_UserRENEW(void *ptr, size_t size, PyObject *mem_handler)
549549
NPY_NO_EXPORT PyObject *
550550
PyDataMem_SetHandler(PyObject *handler)
551551
{
552-
// once the user sets an allocation policy, we cannot guarantee the default allocator without checking the context
552+
/*
553+
* Once the user sets an allocation policy, we cannot guarantee
554+
* the default allocator without checking the context until then,
555+
* this a is a micro-optimization to avoid the `PyContextVar_Get`
556+
*/
553557
default_allocator_policy = 0;
554558

555559
PyObject *old_handler;

0 commit comments

Comments
 (0)
0