Mark Shannon <m...@hotpy.org> added the comment:
There are three kinds of changes that we might want to watch (that I can think of right now): 1. Any change. Rather coarse and potentially expensive. Used by Cinder. 2. A new key being added (or a change to the keys version as a proxy). Useful for detect shadowing of builtins by module globals, would save the keys version check for the module dict in `LOAD_GLOBAL_BUILTINS` and a version check in some `LOAD_METHOD` specializations. 3. The value corresponding to a particular key. With this we could effectively convert both `LOAD_GLOBAL` specializations into a constant, given an effective way to de-optimize. One way to support the three cases above would be to replace the dict version with a pointer to a data structure describing what it watched. If the pointer is `NULL`, then nothing is being watched. The data structure would need 2 bits to cover cases 1 and 2, and 1 bit (or byte) for each key in the dict keys (or case 1 could be implemented by setting all the bits for case 3). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46896> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com