diff options
author | Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> | 2023-05-12 18:27:06 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-12 18:27:06 +0530 |
commit | a052be4c0d9707ebdb935b8314ed22e8d3d99fc0 (patch) | |
tree | 2d2a645339560034cde3eaa198698f0f6ecf5f53 /Objects | |
parent | 5b8cd5abe5924646b9ed90e7ba90085b56d5f634 (diff) | |
download | cpython-git-a052be4c0d9707ebdb935b8314ed22e8d3d99fc0.tar.gz |
GH-104371: check return value of calling `mv.release` (#104417)
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index a1ad5021c4..c1525320a7 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: |