◐ Shell
reader mode source ↗
Skip to content
Closed
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
30 changes: 4 additions & 26 deletions Objects/descrobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1365,9 +1365,7 @@ property_dealloc(PyObject *self)
static PyObject *
property_descr_get(PyObject *self, PyObject *obj, PyObject *type)
{
static PyObject * volatile cached_args = NULL;
PyObject *args;
PyObject *ret;
propertyobject *gs = (propertyobject *)self;

if (obj == NULL || obj == Py_None) {
Expand All @@ -1378,29 +1376,9 @@ property_descr_get(PyObject *self, PyObject *obj, PyObject *type)
PyErr_SetString(PyExc_AttributeError, "unreadable attribute");
return NULL;
}
args = cached_args;
cached_args = NULL;
if (!args) {
args = PyTuple_New(1);
if (!args)
return NULL;
_PyObject_GC_UNTRACK(args);
}
Py_INCREF(obj);
PyTuple_SET_ITEM(args, 0, obj);
ret = PyObject_Call(gs->prop_get, args, NULL);
if (cached_args == NULL && Py_REFCNT(args) == 1) {
assert(PyTuple_GET_SIZE(args) == 1);
assert(PyTuple_GET_ITEM(args, 0) == obj);
cached_args = args;
Py_DECREF(obj);
}
else {
assert(Py_REFCNT(args) >= 1);
_PyObject_GC_TRACK(args);
Py_DECREF(args);
}
return ret;
}

static int
Expand Down
Toggle all file notes Toggle all file annotations