◐ Shell
clean mode source ↗

gh-108511: Add C API functions which do not silently ignore errors by serhiy-storchaka · Pull Request #109025 · python/cpython

Add the following functions:

* PyObject_HasAttrWithError()
* PyObject_HasAttrStringWithError()
* PyMapping_HasKeyWithError()
* PyMapping_HasKeyStringWithError()

@serhiy-storchaka

csm10495 pushed a commit to csm10495/cpython that referenced this pull request

Sep 28, 2023
…ors (pythonGH-109025)

Add the following functions:

* PyObject_HasAttrWithError()
* PyObject_HasAttrStringWithError()
* PyMapping_HasKeyWithError()
* PyMapping_HasKeyStringWithError()

scoder

gmarkall added a commit to gmarkall/numba-cuda that referenced this pull request

May 19, 2025
The simulator needs to be tested with Python 3.12 - it presently does
not fully work on Python 3.13 due to the change in behaviour for
`PyObject_HasAttr()` to no longer silently ignore all errors as it did
previously.

Numba's typecode fingerprinting calls something which is approximately
`PyObject_HasAttr("_numba_type_")` on NumPy arrays during some execution
paths of the simulator, which causes NumPy to raise `ValueError("no
field of name _numba_type_")`. Since Python 3.13 this causes masses of
warnings to be raised that flood the output.

References:

- Python 3.12 `PyObject_HasAttr()`:
  https://docs.python.org/3.12/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods are silently ignored."
- Python 3.13 `PyObject_HasAttr()`:
  https://docs.python.org/3.13/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods aren’t propagated, but instead given to
  > sys.unraisablehook(). For proper error handling, use
  > PyObject_HasAttrWithError(), ..."
- CPython commit adding the recommended functions:
  python/cpython#109025
- CPython issue: python/cpython#108511

gmarkall added a commit to gmarkall/numba-cuda that referenced this pull request

May 19, 2025
The simulator needs to be tested with Python 3.12 - it presently does
not fully work on Python 3.13 due to the change in behaviour for
`PyObject_HasAttr()` to no longer silently ignore all errors as it did
previously.

Numba's typecode fingerprinting calls something which is approximately
`PyObject_HasAttr("_numba_type_")` on NumPy arrays during some execution
paths of the simulator, which causes NumPy to raise `ValueError("no
field of name _numba_type_")`. Since Python 3.13 this causes masses of
warnings to be raised that flood the output.

References:

- Python 3.12 `PyObject_HasAttr()`:
  https://docs.python.org/3.12/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods are silently ignored."
- Python 3.13 `PyObject_HasAttr()`:
  https://docs.python.org/3.13/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods aren’t propagated, but instead given to
  > sys.unraisablehook(). For proper error handling, use
  > PyObject_HasAttrWithError(), ..."
- CPython commit adding the recommended functions:
  python/cpython#109025
- CPython issue: python/cpython#108511

gmarkall added a commit to gmarkall/numba-cuda that referenced this pull request

May 20, 2025
The simulator needs to be tested with Python 3.12 - it presently does
not fully work on Python 3.13 due to the change in behaviour for
`PyObject_HasAttr()` to no longer silently ignore all errors as it did
previously.

Numba's typecode fingerprinting calls something which is approximately
`PyObject_HasAttr("_numba_type_")` on NumPy arrays during some execution
paths of the simulator, which causes NumPy to raise `ValueError("no
field of name _numba_type_")`. Since Python 3.13 this causes masses of
warnings to be raised that flood the output.

References:

- Python 3.12 `PyObject_HasAttr()`:
  https://docs.python.org/3.12/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods are silently ignored."
- Python 3.13 `PyObject_HasAttr()`:
  https://docs.python.org/3.13/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods aren’t propagated, but instead given to
  > sys.unraisablehook(). For proper error handling, use
  > PyObject_HasAttrWithError(), ..."
- CPython commit adding the recommended functions:
  python/cpython#109025
- CPython issue: python/cpython#108511

gmarkall added a commit to gmarkall/numba-cuda that referenced this pull request

May 20, 2025
The simulator needs to be tested with Python 3.12 - it presently does
not fully work on Python 3.13 due to the change in behaviour for
`PyObject_HasAttr()` to no longer silently ignore all errors as it did
previously.

Numba's typecode fingerprinting calls something which is approximately
`PyObject_HasAttr("_numba_type_")` on NumPy arrays during some execution
paths of the simulator, which causes NumPy to raise `ValueError("no
field of name _numba_type_")`. Since Python 3.13 this causes masses of
warnings to be raised that flood the output.

References:

- Python 3.12 `PyObject_HasAttr()`:
  https://docs.python.org/3.12/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods are silently ignored."
- Python 3.13 `PyObject_HasAttr()`:
  https://docs.python.org/3.13/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods aren’t propagated, but instead given to
  > sys.unraisablehook(). For proper error handling, use
  > PyObject_HasAttrWithError(), ..."
- CPython commit adding the recommended functions:
  python/cpython#109025
- CPython issue: python/cpython#108511

gmarkall added a commit to gmarkall/numba-cuda that referenced this pull request

May 20, 2025
The simulator needs to be tested with Python 3.12 - it presently does
not fully work on Python 3.13 due to the change in behaviour for
`PyObject_HasAttr()` to no longer silently ignore all errors as it did
previously.

Numba's typecode fingerprinting calls something which is approximately
`PyObject_HasAttr("_numba_type_")` on NumPy arrays during some execution
paths of the simulator, which causes NumPy to raise `ValueError("no
field of name _numba_type_")`. Since Python 3.13 this causes masses of
warnings to be raised that flood the output.

References:

- Python 3.12 `PyObject_HasAttr()`:
  https://docs.python.org/3.12/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods are silently ignored."
- Python 3.13 `PyObject_HasAttr()`:
  https://docs.python.org/3.13/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods aren’t propagated, but instead given to
  > sys.unraisablehook(). For proper error handling, use
  > PyObject_HasAttrWithError(), ..."
- CPython commit adding the recommended functions:
  python/cpython#109025
- CPython issue: python/cpython#108511

gmarkall added a commit to gmarkall/numba-cuda that referenced this pull request

May 27, 2025
The simulator needs to be tested with Python 3.12 - it presently does
not fully work on Python 3.13 due to the change in behaviour for
`PyObject_HasAttr()` to no longer silently ignore all errors as it did
previously.

Numba's typecode fingerprinting calls something which is approximately
`PyObject_HasAttr("_numba_type_")` on NumPy arrays during some execution
paths of the simulator, which causes NumPy to raise `ValueError("no
field of name _numba_type_")`. Since Python 3.13 this causes masses of
warnings to be raised that flood the output.

References:

- Python 3.12 `PyObject_HasAttr()`:
  https://docs.python.org/3.12/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods are silently ignored."
- Python 3.13 `PyObject_HasAttr()`:
  https://docs.python.org/3.13/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods aren’t propagated, but instead given to
  > sys.unraisablehook(). For proper error handling, use
  > PyObject_HasAttrWithError(), ..."
- CPython commit adding the recommended functions:
  python/cpython#109025
- CPython issue: python/cpython#108511

gmarkall added a commit to gmarkall/numba-cuda that referenced this pull request

May 27, 2025
The simulator needs to be tested with Python 3.12 - it presently does
not fully work on Python 3.13 due to the change in behaviour for
`PyObject_HasAttr()` to no longer silently ignore all errors as it did
previously.

Numba's typecode fingerprinting calls something which is approximately
`PyObject_HasAttr("_numba_type_")` on NumPy arrays during some execution
paths of the simulator, which causes NumPy to raise `ValueError("no
field of name _numba_type_")`. Since Python 3.13 this causes masses of
warnings to be raised that flood the output.

References:

- Python 3.12 `PyObject_HasAttr()`:
  https://docs.python.org/3.12/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods are silently ignored."
- Python 3.13 `PyObject_HasAttr()`:
  https://docs.python.org/3.13/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods aren’t propagated, but instead given to
  > sys.unraisablehook(). For proper error handling, use
  > PyObject_HasAttrWithError(), ..."
- CPython commit adding the recommended functions:
  python/cpython#109025
- CPython issue: python/cpython#108511

gmarkall added a commit to gmarkall/numba-cuda that referenced this pull request

May 27, 2025
The simulator needs to be tested with Python 3.12 - it presently does
not fully work on Python 3.13 due to the change in behaviour for
`PyObject_HasAttr()` to no longer silently ignore all errors as it did
previously.

Numba's typecode fingerprinting calls something which is approximately
`PyObject_HasAttr("_numba_type_")` on NumPy arrays during some execution
paths of the simulator, which causes NumPy to raise `ValueError("no
field of name _numba_type_")`. Since Python 3.13 this causes masses of
warnings to be raised that flood the output.

References:

- Python 3.12 `PyObject_HasAttr()`:
  https://docs.python.org/3.12/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods are silently ignored."
- Python 3.13 `PyObject_HasAttr()`:
  https://docs.python.org/3.13/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods aren’t propagated, but instead given to
  > sys.unraisablehook(). For proper error handling, use
  > PyObject_HasAttrWithError(), ..."
- CPython commit adding the recommended functions:
  python/cpython#109025
- CPython issue: python/cpython#108511

gmarkall added a commit to gmarkall/numba-cuda that referenced this pull request

May 27, 2025
The simulator needs to be tested with Python 3.12 - it presently does
not fully work on Python 3.13 due to the change in behaviour for
`PyObject_HasAttr()` to no longer silently ignore all errors as it did
previously.

Numba's typecode fingerprinting calls something which is approximately
`PyObject_HasAttr("_numba_type_")` on NumPy arrays during some execution
paths of the simulator, which causes NumPy to raise `ValueError("no
field of name _numba_type_")`. Since Python 3.13 this causes masses of
warnings to be raised that flood the output.

References:

- Python 3.12 `PyObject_HasAttr()`:
  https://docs.python.org/3.12/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods are silently ignored."
- Python 3.13 `PyObject_HasAttr()`:
  https://docs.python.org/3.13/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods aren’t propagated, but instead given to
  > sys.unraisablehook(). For proper error handling, use
  > PyObject_HasAttrWithError(), ..."
- CPython commit adding the recommended functions:
  python/cpython#109025
- CPython issue: python/cpython#108511

gmarkall added a commit to NVIDIA/numba-cuda that referenced this pull request

May 27, 2025
The simulator needs to be tested with Python 3.12 - it presently does
not fully work on Python 3.13 due to the change in behaviour for
`PyObject_HasAttr()` to no longer silently ignore all errors as it did
previously.

Numba's typecode fingerprinting calls something which is approximately
`PyObject_HasAttr("_numba_type_")` on NumPy arrays during some execution
paths of the simulator, which causes NumPy to raise `ValueError("no
field of name _numba_type_")`. Since Python 3.13 this causes masses of
warnings to be raised that flood the output.

References:

- Python 3.12 `PyObject_HasAttr()`:
  https://docs.python.org/3.12/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods are silently ignored."
- Python 3.13 `PyObject_HasAttr()`:
  https://docs.python.org/3.13/c-api/object.html#c.PyObject_HasAttr
  > "Exceptions that occur when this calls __getattr__() and
  > __getattribute__() methods aren’t propagated, but instead given to
  > sys.unraisablehook(). For proper error handling, use
  > PyObject_HasAttrWithError(), ..."
- CPython commit adding the recommended functions:
  python/cpython#109025
- CPython issue: python/cpython#108511