[New-bugs-announce] [issue28265] builtin_function_or_method's __getattribute__ not applicable to self

Alexander Sosedkin report at bugs.python.org
Sat Sep 24 16:13:55 EDT 2016


New submission from Alexander Sosedkin:

I've managed to obtain several objects, which __getattribute__ cannot be applied to them.

Minimal non-working example (a more detailed one is attached):
b = abs.__class__
b.__getattribute__(b, 'x')

Proxying such objects turned out to be even harder that proxying everything else in Python (as if it wasn't already mindbogglingly hard).

As you can see, given that 'builtin_function_or_method' object you can obtain its __getattribute__, but you cannot apply it.

Tested with Python 3.5.2 and 3.6.0b1.

What's the deal with that broken __getattribute__? It seems to be specific to 'builtin_function_or_method' class, but why is it broken? If it is "PyObject_GenericGetAttr", then why object.__getattribute__(b, 'x') works? What am I missing?

----------
components: Interpreter Core
files: getattribute.py
messages: 277332
nosy: t184256
priority: normal
severity: normal
status: open
title: builtin_function_or_method's __getattribute__ not applicable to self
type: behavior
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file44802/getattribute.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28265>
_______________________________________


More information about the New-bugs-announce mailing list