On Thu, 26 Aug 2021 at 18:29, Nick Coghlan <ncogh...@gmail.com> wrote: [Guido wrote] > > PS. The mapping from varname to position should be on the code object, not > > on the frame. This is how Mark does it (though his implementation would > > need to be extended to take cells into account). > > It's taking cells into account that forces the lookup mapping to be on > the frame: different executions of the same code object may reference > different cell objects.
Technically, if you design the fast refs mapping so that even cell references have to do an indirection through the fast locals array, then you can put the name-to-fast-locals-offset mapping on the code object. Mine doesn't do that though, it references the cells directly instead. I don't think it makes much difference in practice though, and I don't like the idea of storing a lazily initialised cache on nominally immutable code objects. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/A6CLBN6EUA26BAIJID7UB3KXSF3MSP5D/ Code of Conduct: http://python.org/psf/codeofconduct/