Ken Jin
Ken Jin
Also, `co_code` has been gone since https://github.com/python/cpython/commit/2bde6827ea4f136297b2d882480b981ff26262b6. Which is 3.11a7 and up only. For that you'd need the internal `_PyCode_GetCode` (Huh, I just realised we should probably expose that in...
> No. Please don't use an internal C API to read co_code. This attribute is accessible in Python, so we should provide a public function for that. Sorry I wasn't...
A very significant (15%) increase in hit rates for `test_typing`. That module represents the best case for this specialisation because nearly all its classes use `__getattr__`. This is also the...
Alright. `analyze_descriptor` will need to be a lot more robust then. It will need to detect cases where it sees a `__getattr__` but the attribute is present.
It's alarming that specialisation misses increased more than hits (~75k vs 55k). Maybe it means that for most types with `__getattr__`, it's expected that there's nothing there? This needs more...
> What are we checking for here? > ,,, > This is what I think we want to do w.r.t overriding these methods: > Is that correct? Yes. > If...
> > There's one more special case for custom **getattribute**: where it's set to the defaut lookup (PyObject_GenericGetAttr). In such cases if there's no **getattr**, we can just treat this...
Ping @markshannon . Is there anything left for me to do?
Thanks! I realized a few holes in my own ideas and your comments gave me a lot of food for thought. > mypy itself is actually also a good example...
Just to reiterate so that I don't get lost in the weeds here: 1. typing.py's LRU cache itself doesn't leak references. It just holds onto other things which *may* leak...