cpython (2.7): don't overwrite the error from PyObject_GetAttrString (closes #4346)
![](https://secure.gravatar.com/avatar/8ac615df352a970211b0e3d94a307c6d.jpg?s=120&d=mm&r=g)
http://hg.python.org/cpython/rev/aa4b4487c7ad changeset: 91434:aa4b4487c7ad branch: 2.7 parent: 91431:eb0921b2100b user: Benjamin Peterson <benjamin@python.org> date: Thu Jun 26 23:27:41 2014 -0700 summary: don't overwrite the error from PyObject_GetAttrString (closes #4346) files: Misc/NEWS | 3 +++ Objects/abstract.c | 12 ++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #4346: In PyObject_CallMethod and PyObject_CallMethodObjArgs, don't + overwrite the error set in PyObject_GetAttr. + - Issue #21831: Avoid integer overflow when large sizes and offsets are given to the buffer type. diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2617,10 +2617,8 @@ return null_error(); func = PyObject_GetAttrString(o, name); - if (func == NULL) { - PyErr_SetString(PyExc_AttributeError, name); - return 0; - } + if (func == NULL) + return NULL; if (!PyCallable_Check(func)) { type_error("attribute of type '%.200s' is not callable", func); @@ -2656,10 +2654,8 @@ return null_error(); func = PyObject_GetAttrString(o, name); - if (func == NULL) { - PyErr_SetString(PyExc_AttributeError, name); - return 0; - } + if (func == NULL) + return NULL; if (!PyCallable_Check(func)) { type_error("attribute of type '%.200s' is not callable", func); -- Repository URL: http://hg.python.org/cpython
participants (1)
-
benjamin.peterson