[New-bugs-announce] [issue41991] Remove _PyObject_HasAttrId

Serhiy Storchaka report at bugs.python.org
Sat Oct 10 03:47:11 EDT 2020


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

_PyObject_HasAttrId() can return -1, 0 or 1. It returns -1 when cannot create a string (most likely due to MemoryError or UnicodeDecodeError), but returns 0 and silences all exceptions raised when look up the attribute (including MemoryError, KeybordInterruptError and RecursionError). Silencing arbitrary exceptions is bad, and the interface of the function is inconsistent, so it is better to remove it and replace all 5 of its occurrences in 3 files with _PyObject_LookupAttrId(). It is private API, so we can do it without breaking user code.

----------
components: Interpreter Core
messages: 378370
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Remove _PyObject_HasAttrId
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41991>
_______________________________________


More information about the New-bugs-announce mailing list