File tree 1 file changed +9
-3
lines changed
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 {
2022
2022
detail::list_iterator end () const { return {*this , PyList_GET_SIZE (m_ptr)}; }
2023
2023
template <typename T>
2024
2024
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
+ }
2026
2028
}
2027
2029
template <typename IdxType,
2028
2030
typename ValType,
2029
2031
detail::enable_if_t <std::is_integral<IdxType>::value, int > = 0 >
2030
2032
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
+ }
2033
2039
}
2034
2040
};
2035
2041
You can’t perform that action at this time.
0 commit comments