MCPcopy Create free account
hub / github.com/numpy/numpy / geterrcall

Function geterrcall

numpy/core/_ufunc_config.py:315–357  ·  view source on GitHub ↗

Return the current callback function used on floating-point errors. 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 `

()

Source from the content-addressed store, hash-verified

313
314@set_module('numpy')
315def geterrcall():
316 """
317 Return the current callback function used on floating-point errors.
318
319 When the error handling for a floating-point error (one of "divide",
320 "over", "under", or "invalid") is set to 'call' or 'log', the function
321 that is called or the log instance that is written to is returned by
322 `geterrcall`. This function or log instance has been set with
323 `seterrcall`.
324
325 Returns
326 -------
327 errobj : callable, log instance or None
328 The current error handler. If no handler was set through `seterrcall`,
329 ``None`` is returned.
330
331 See Also
332 --------
333 seterrcall, seterr, geterr
334
335 Notes
336 -----
337 For complete documentation of the types of floating-point exceptions and
338 treatment options, see `seterr`.
339
340 Examples
341 --------
342 >>> np.geterrcall() # we did not yet set a handler, returns None
343
344 >>> oldsettings = np.seterr(all='call')
345 >>> def err_handler(type, flag):
346 ... print("Floating point error (%s), with flag %s" % (type, flag))
347 >>> oldhandler = np.seterrcall(err_handler)
348 >>> np.array([1, 2, 3]) / 0.0
349 Floating point error (divide by zero), with flag 1
350 array([inf, inf, inf])
351
352 >>> cur_handler = np.geterrcall()
353 >>> cur_handler is err_handler
354 True
355
356 """
357 return umath.geterrobj()[2]
358
359
360class _unspecified:

Callers 1

seterrcallFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected