summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS3
-rw-r--r--Objects/abstract.c12
2 files changed, 7 insertions, 8 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 66c558a..4f86a51 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 3c88711..5707eb2 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);