Closed fniephaus closed 1 year ago
The __abstractmethods__
descriptor is indeed there and it has a getter. When called in readMember
, the getter raises an AttributeError
that gets translated into the error you see. So the behavior is kinda conunterintuitive, but technically correct. The member is there, it has a getter and in general, we cannot know that the getter would throw the exception without invoking it and we can only do that in readMember
because isMemeberReadable
shouldn't have side-effects. You can even see a similar glitch in CPython, where it will autocomplete list.__abst
to list.__abstractmethods__
, which will then raise AttributeError
.
Since we know what this particular getter does, we could hardcode some specific logic for it in our isMemberRedable
. But I would prefer not to do that. Is it causing you real problems or is it something that you just noticed? Through which message did you see it listed?
Thanks for following up, @msimacek. This is not blocking for us, but it's something I came across when inspecting Python list with our interop object explorer. Maybe your findings should be added to the broader discussion of what members are (or should be) in Truffle languages. /cc @chumer
It seems we didn't reach any action items here, so let's close this issue as "this is just how python works".
The Python
list
type (and possibly others) list__abstractmethods__
as a member and claim that it is readable. Read member operations, however, fail with an exception.Repro