bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / geterrcall
function
numpy:geterrcall
source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/_core/_ufunc_config.py :308
Signature
def geterrcall ( ) Summary
Return the current callback function used on floating-point errors.
Extended Summary
When the error handling for a floating-point error (one of "divide", "over", "under", or "invalid") is set to 'call' or 'log', the function that is called or the log instance that is written to is returned by geterrcall. This function or log instance has been set with seterrcall.
Returns
errobj: callable, log instance or NoneThe current error handler. If no handler was set through
seterrcall,Noneis returned.
Notes
For complete documentation of the types of floating-point exceptions and treatment options, see seterr.
Examples
import numpy as np np.geterrcall() # we did not yet set a handler, returns None✓
orig_settings = np.seterr(all='call') def err_handler(type, flag): print("Floating point error (%s), with flag %s" % (type, flag)) old_handler = np.seterrcall(err_handler) np.array([1, 2, 3]) / 0.0✓
cur_handler = np.geterrcall() cur_handler is err_handler old_settings = np.seterr(**orig_settings) # restore original old_handler = np.seterrcall(None) # restore original✓
See also
- geterr
- seterr
- seterrcall
Aliases
-
numpy.geterrcall