summaryrefslogtreecommitdiffstats
path: root/Objects/typeobject.c
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2023-05-12 12:57:06 (GMT)
committerGitHub <noreply@github.com>2023-05-12 12:57:06 (GMT)
commita052be4c0d9707ebdb935b8314ed22e8d3d99fc0 (patch)
tree2d2a645339560034cde3eaa198698f0f6ecf5f53 /Objects/typeobject.c
parent5b8cd5abe5924646b9ed90e7ba90085b56d5f634 (diff)
downloadcpython-a052be4c0d9707ebdb935b8314ed22e8d3d99fc0.zip
cpython-a052be4c0d9707ebdb935b8314ed22e8d3d99fc0.tar.gz
cpython-a052be4c0d9707ebdb935b8314ed22e8d3d99fc0.tar.bz2
GH-104371: check return value of calling `mv.release` (#104417)
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r--Objects/typeobject.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index a1ad502..c152532 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -9158,7 +9158,13 @@ releasebuffer_call_python(PyObject *self, Py_buffer *buffer)
Py_DECREF(ret);
}
if (!is_buffer_wrapper) {
- PyObject_CallMethodNoArgs(mv, &_Py_ID(release));
+ PyObject *res = PyObject_CallMethodNoArgs(mv, &_Py_ID(release));
+ if (res == NULL) {
+ PyErr_WriteUnraisable(self);
+ }
+ else {
+ Py_DECREF(res);
+ }
}
Py_DECREF(mv);
end: