[Types-sig] Low-hanging fruit: recognizing builtins

Skip Montanaro skip@mojam.com (Skip Montanaro)
Wed, 15 Dec 1999 23:57:36 -0600 (CST)

    Guido> A first approximation would be to go hunt through all existing
    Guido> code objects in a module for LOAD_GLOBAL and STORE_GLOBAL opcodes
    Guido> with built-in names; for all such built-in names that have no
    Guido> STORE_GLOBAL anywhere, it's "safe enough" to use the special
    Guido> opcode.  Then of course you will have to hunt through the
    Guido> bytecode for sequences of LOAD_GLOBAL(<name>), followed by
    Guido> arbitrary code to load an object, followed by CALL_FUNCTION(1).

Don't you also have to watch out for the dreaded

    from my_rewritten_builtins import *