]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-32544: Speed up hasattr() and getattr() (GH-5173)
authorINADA Naoki <methane@users.noreply.github.com>
Tue, 16 Jan 2018 11:52:41 +0000 (20:52 +0900)
committerGitHub <noreply@github.com>
Tue, 16 Jan 2018 11:52:41 +0000 (20:52 +0900)
commit378edee0a3b913d60653dc17dfe61d83405a8135
treee91c9b9b446aa0ce076da778bde6c1da27ff5e23
parentb44c5169f64178d2ff2914187b315549e7ab0cb6
bpo-32544: Speed up hasattr() and getattr() (GH-5173)

AttributeError was raised always when attribute is not found.
This commit skip raising AttributeError when `tp_getattro` is `PyObject_GenericGetAttr`.
It makes hasattr() and getattr() about 4x faster when attribute is not found.
Include/object.h
Misc/NEWS.d/next/Core and Builtins/2018-01-16-18-51-58.bpo-32544.ga-cFE.rst [new file with mode: 0644]
Modules/_threadmodule.c
Objects/object.c
Python/bltinmodule.c