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)
if (PyMethod_Check(callable))
{
// if (callable->ob_refcnt == 1)
// {
// Pyston change:
// Py_XDECREF(((PyMethodObject*)callable)->im_self);
// Py_XDECREF(PyMethod_Self((PyObject *)callable));
// Py_INCREF(inst);
// ((PyMethodObject*)callable)->im_self = inst;
// PyMethod_Self((PyObject *)callable) = inst;
// Py_INCREF(callable);
// return callable;
// }
// else
if (callable->ob_refcnt == 1)
{
// Pyston change: use new PyMethod_SetSelf API to do this
// in Pyston.
/* Py_XDECREF(((PyMethodObject*)callable)->im_self); */
/* Py_INCREF(inst); */
/* ((PyMethodObject*)callable)->im_self = inst; */
/* Py_INCREF(callable); */
/* return callable; */
PyMethod_SetSelf(callable, inst);
return callable;
}
else
// Pyston change:
return callable->ob_type->tp_descr_get(
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