]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
potentially useless optimization
authorJeremy Hylton <jeremy@alum.mit.edu>
Wed, 26 Apr 2000 20:39:20 +0000 (20:39 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Wed, 26 Apr 2000 20:39:20 +0000 (20:39 +0000)
commit9e392e2412308c7923195f226510bb1f174be215
tree234c290c12a4cba247e7fd044e0cbb0998180636
parent50422b403c4ebea87f7af840e5c5cf147155639e
potentially useless optimization

The previous checkin (2.84) added a PyErr_Format call that made the
cost of raising an AttributeError much more expensive.  In general
this doesn't matter, except that checks for __init__ and
__del__ methods, where exceptions are caught and cleared in C, also
got much more expensive.

The fix is to split instance_getattr1 into two calls:

instance_getattr2 checks the instance and the class for the attribute
and returns it or returns NULL on error.  It does not raise an
exception.

instance_getattr1 does rexec checks, then calls instance_getattr2.  It
raises an exception if instance_getattr2 returns NULL.

PyInstance_New and instance_dealloc now call instance_getattr2
directly.
Objects/classobject.c