This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pablogsal
Recipients Guido.van.Rossum, gvanrossum, pablogsal, yselivanov
Date 2021-01-05.02:19:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> Thanks! Do you have any plans for further inline caches?

Yeah, we are experimenting with some ideas here: 

>  I was wondering if we could reverse the situation for slots again by adding slots support to the LOAD_ATTR opcode inline cache...

I think we can do it as long as we can detect easily if a given descriptor is immutable. The problem of mutability is this code:

class Descriptor:

class C:
    def __init__(self):
        self.x = 1
    x = Descriptor()

def f(o):
    return o.x

o = C()
for i in range(10000):
    assert f(o) == 1

Descriptor.__get__ = lambda self, instance, value: 2
Descriptor.__set__ = lambda *args: None


In this case, if we do not skip the cache for mutable descriptors, the code will not reflect the new result (2 instead of 1). __slots__ are immutable descriptors so we should be good as long as we can detect them.
Date User Action Args
2021-01-05 02:19:54pablogsalsetrecipients: + pablogsal, gvanrossum, yselivanov, Guido.van.Rossum
2021-01-05 02:19:54pablogsalsetmessageid: <>
2021-01-05 02:19:54pablogsallinkissue42093 messages
2021-01-05 02:19:53pablogsalcreate