File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -2022,14 +2022,20 @@ class list : public object {
20222022 detail::list_iterator end () const { return {*this , PyList_GET_SIZE (m_ptr)}; }
20232023 template <typename T>
20242024 void append (T &&val) /* py-non-const */ {
2025- PyList_Append (m_ptr, detail::object_or_cast (std::forward<T>(val)).ptr ());
2025+ if (PyList_Append (m_ptr, detail::object_or_cast (std::forward<T>(val)).ptr ()) != 0 ) {
2026+ throw error_already_set ();
2027+ }
20262028 }
20272029 template <typename IdxType,
20282030 typename ValType,
20292031 detail::enable_if_t <std::is_integral<IdxType>::value, int > = 0 >
20302032 void insert (const IdxType &index, ValType &&val) /* py-non-const */ {
2031- PyList_Insert (
2032- m_ptr, ssize_t_cast (index), detail::object_or_cast (std::forward<ValType>(val)).ptr ());
2033+ if (PyList_Insert (m_ptr,
2034+ ssize_t_cast (index),
2035+ detail::object_or_cast (std::forward<ValType>(val)).ptr ())
2036+ != 0 ) {
2037+ throw error_already_set ();
2038+ }
20332039 }
20342040};
20352041
You can’t perform that action at this time.
0 commit comments