Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Check PyObject_CallFunctionObjArgs return value
  • Loading branch information
skirpichev committed Aug 22, 2023
commit 74c3d138ce75d08470e0e76571ce77424c3597c1
9 changes: 5 additions & 4 deletions Objects/moduleobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,15 +869,16 @@ _Py_module_getattro(PyModuleObject *m, PyObject *name)
static int
module_setattro(PyModuleObject *mod, PyObject *name, PyObject *value)
{
PyObject *ret;
assert(mod->md_dict != NULL);
if (value == NULL) {
Comment thread
skirpichev marked this conversation as resolved.
Outdated
PyObject *delattr = PyDict_GetItemWithError(mod->md_dict, &_Py_ID(__delattr__));
if (PyErr_Occurred()) {
return -1;
}
if (delattr) {
PyObject_CallFunctionObjArgs(delattr, name, NULL);
if (PyErr_Occurred()) {
ret = PyObject_CallFunctionObjArgs(delattr, name, NULL);
if (ret == NULL) {
return -1;
}
Comment thread
skirpichev marked this conversation as resolved.
return 0;
Expand All @@ -888,8 +889,8 @@ module_setattro(PyModuleObject *mod, PyObject *name, PyObject *value)
return -1;
}
if (setattr) {
PyObject_CallFunctionObjArgs(setattr, name, value, NULL);
if (PyErr_Occurred()) {
ret = PyObject_CallFunctionObjArgs(setattr, name, value, NULL);
if (ret == NULL) {
return -1;
}
return 0;
Expand Down