hpy icon indicating copy to clipboard operation
hpy copied to clipboard

Functions should not suppress unrelated exceptions

Open steve-s opened this issue 1 year ago • 0 comments

I think that issue https://github.com/capi-workgroup/problems/issues/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.

steve-s avatar Jul 12 '23 08:07 steve-s