]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-102213: Optimize the performance of `__getattr__` (GH-102248)
authorwangxiang-hz <34048878+wangxiang-hz@users.noreply.github.com>
Sat, 11 Mar 2023 11:11:37 +0000 (19:11 +0800)
committerGitHub <noreply@github.com>
Sat, 11 Mar 2023 11:11:37 +0000 (19:11 +0800)
commitaa0a73d1bc53dcb6348a869df1e775138991e561
tree66ad74f8d199076d88e5150b999895cd15807560
parent5ffdaf748d98da6065158534720f1996a45a0072
gh-102213: Optimize the performance of `__getattr__`  (GH-102248)

When __getattr__ is defined, python with try to find an attribute using _PyObject_GenericGetAttrWithDict
find nothing is reasonable so we don't need an exception, it will hurt performance.
Include/internal/pycore_object.h
Misc/NEWS.d/next/Core and Builtins/2023-02-26-13-12-55.gh-issue-102213.fTH8X7.rst [new file with mode: 0644]
Objects/object.c
Objects/typeobject.c