Skip to content

API: Slash down errstate related API to make it sustainable #23900

@seberg

Description

@seberg

For NumPy 2.0 (or well, TBH, I think we could also pull this off in a normal release, but then I might ask for a brief NEP, because I want to jump deprecations), I would like:

  • Delete any weird "log" and "callback" stuff from the errobj/errstate
  • Remove seterrobj, geterrobj, seterrcall, geterrcall and the ufunc errobj=
    • I would add an error on the last one with a note that we are willing to accept patches to restore some of its behavior if there is a real need. I don't hate allowing passing this state in, but I think it should evolve (and probably have a new name).
  • geterr() and seterr() are OK, since they take/return dicts. errstate is preferable, but they don't matter for this. (I am OK with removing them, but I think just deprecating them is also fine.)

errobj is a weird mutable list, I don't think using it is good and I suspect it will just make fixing the errstate hard.

Now the callback is probably used a couple of time in the wild, I found this: https://github.com/aglavic/genx/blob/8083fb73271f24dbf8c92433a6a86b422fefede5/genx/genx/core/custom_logging.py#L80

I think it should be fine (and backwards compatible) to ask such programs to monkey-patch warnings.showwarning instead.


Can I get a few 👍 for this change? :)

EDIT: Whooops, the ufunc keyword argument is called extobj not errobj, shows how much its used ;).

Metadata

Metadata

Assignees

No one assigned

    Labels

    62 - Python APIChanges or additions to the Python API. Mailing list should usually be notified.

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions