• Kevin Modzelewski's avatar
    Switch to calling tp_richcompare · 0554a034
    Kevin Modzelewski authored
    The notable places that are changed are PyEq, PyLt, and
    compare/compareInternal.
    
    The old codepaths are still in there (though thankfully
    now with reduced duplication with cpython), since for anything
    that defines a Python-level __lt__, it's better to call that
    with our rewriting support, rather than calling it through
    slot_tp_richcompare.
    
    The control flow is kind of messy, since I don't think we
    know what the right long-term organization is for these kinds of
    things.  But basically, it's:
    - if we can't rewrite, just call the C slot
    - if we can rewrite, and we think calling tp_richcompare is profitable
      (ie it's not slot_tp_richcompare), we call that and emit a call to
      it in the patchpoint
    - otherwise, we try calling the python attribute
    
    Actual conversion of our attributes to tp_richcompare in the next commit.
    0554a034
builtins.cpp 46 KB