Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Update property_descr_set to use vectorcall if possible. Patch by Dong-hee
Na.
25 changes: 18 additions & 7 deletions Objects/descrobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1614,31 +1614,42 @@ property_descr_set(PyObject *self, PyObject *obj, PyObject *value)
propertyobject *gs = (propertyobject *)self;
PyObject *func, *res;

if (value == NULL)
if (value == NULL) {
func = gs->prop_del;
else
}
else {
func = gs->prop_set;
}

if (func == NULL) {
if (gs->prop_name != NULL) {
PyErr_Format(PyExc_AttributeError,
value == NULL ?
"can't delete attribute %R" :
"can't set attribute %R",
gs->prop_name);
} else {
}
else {
PyErr_SetString(PyExc_AttributeError,
value == NULL ?
"can't delete attribute" :
"can't set attribute");
}
return -1;
}
if (value == NULL)

if (value == NULL) {
res = PyObject_CallOneArg(func, obj);
else
res = PyObject_CallFunctionObjArgs(func, obj, value, NULL);
if (res == NULL)
}
else {
PyObject *args[] = { obj, value };
res = PyObject_Vectorcall(func, args, 2, NULL);
}

if (res == NULL) {
return -1;
}

Py_DECREF(res);
return 0;
}
Expand Down