• Kevin Modzelewski's avatar
    Some work on the Grand CAPI Unification · 1d396ecd
    Kevin Modzelewski authored
    ie trying to start running real C modules.  The goal has always been to
    run them without modification and without a proxy layer, and this is the first step.
    
    The first issue is conversion between PyObject and our internal representation,
    "Box" (needs to be renamed).  Once they have the same layout, some hacks were
    needed to make them seem like the same thing, even though we can attach C++
    methods on the Box side, but use PyObject in C code.
    
    The next major issue was PyTypeObject, since the structure is directly exposed to
    extensions.  I just added the similar fields to BoxedClass, so they can be
    used interchangeably; the "real" ones are the BoxedClass ones, but we'll migrate
    them incrementally.
    
    There's also the issue that PyTypeObject's are typically created statically,
    so I added registerStaticRootMemory to the GC interface.
    
    Also add in a smattering of other API functions, and the _sha module works
    (who cares if it's normally disabled).
    
    The C API is quite constraining about choices of data structure implementation; it's
    in direct conflict with the std::string API, for example.  For now, close our eyes
    and let the C API modify the internal bytes of std::string.
    1d396ecd
builtins.cpp 22.4 KB