numpy.setbufsize — NumPy v2.6.dev0 Manual

numpy.setbufsize(size)

[source]

#

Set the size of the buffer used in ufuncs.

Changed in version 2.0: The scope of setting the buffer is tied to the

numpy.errstate

context. Exiting a witherrstate(): will also restore the bufsize.

Parameters:sizeintSize of buffer.

Returns:bufsizeintPrevious size of ufunc buffer in bytes.

Notes

Concurrency note: see

Floating point error handling

Examples

When exiting a

numpy.errstate

context manager the bufsize is restored:

>>> importnumpyasnp>>> withnp.errstate():... np.setbufsize(4096)... print(np.getbufsize())...81924096>>> np.getbufsize()8192