hpyproject / hpy

HPy: a better API for Python

Home Page:https://hpyproject.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Functions should not suppress unrelated exceptions

steve-s opened this issue · comments

I think that issue capi-workgroup/problems#51 raises (pun intended) good points about APIs such as:

  • PyDict_GetItem and PyDict_GetItemString
  • PyMapping_HasKey and PyMapping_HasKeyString
  • PyObject_HasAttr and PyObject_HasAttrString
  • PySys_GetObject

For the time being HPy only exposes PyObject_HasAttr and I think we should change its semantics to match the PyObject_HasAttrEx suggested in the issue. For older CPython versions using a hand-written implementation and for newer delegating to PyObject_HasAttrEx if it makes it upstream.