From: Benjamin Peterson Date: Fri, 27 Jun 2014 06:27:41 +0000 (-0700) Subject: don't overwrite the error from PyObject_GetAttrString (closes #4346) X-Git-Tag: v2.7.8~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=df71dcbef212d0800c428532872d32727c58776b;p=python don't overwrite the error from PyObject_GetAttrString (closes #4346) --- diff --git a/Misc/NEWS b/Misc/NEWS index 66c558a267..4f86a51fcf 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ What's New in Python 2.7.8? 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 index 3c88711663..5707eb2b88 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2617,10 +2617,8 @@ PyObject_CallMethod(PyObject *o, char *name, char *format, ...) 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 @@ _PyObject_CallMethod_SizeT(PyObject *o, char *name, char *format, ...) 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);