Commit 4610d3b8 authored by Boxiang Sun's avatar Boxiang Sun

allow ExtensionClass change the im_self of PyMethodObject in Pyston

parent 8d1f1650
...@@ -925,18 +925,19 @@ PyECMethod_New_(PyObject *callable, PyObject *inst) ...@@ -925,18 +925,19 @@ PyECMethod_New_(PyObject *callable, PyObject *inst)
if (PyMethod_Check(callable)) if (PyMethod_Check(callable))
{ {
// if (callable->ob_refcnt == 1) if (callable->ob_refcnt == 1)
// { {
// Pyston change: // Pyston change: use new PyMethod_SetSelf API to do this
// Py_XDECREF(((PyMethodObject*)callable)->im_self); // in Pyston.
// Py_XDECREF(PyMethod_Self((PyObject *)callable)); /* Py_XDECREF(((PyMethodObject*)callable)->im_self); */
// Py_INCREF(inst); /* Py_INCREF(inst); */
// ((PyMethodObject*)callable)->im_self = inst; /* ((PyMethodObject*)callable)->im_self = inst; */
// PyMethod_Self((PyObject *)callable) = inst; /* Py_INCREF(callable); */
// Py_INCREF(callable); /* return callable; */
// return callable; PyMethod_SetSelf(callable, inst);
// } return callable;
// else }
else
// Pyston change: // Pyston change:
return callable->ob_type->tp_descr_get( return callable->ob_type->tp_descr_get(
callable, inst, callable, inst,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment