mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-17 06:00:51 +00:00
Merge branch 'pybind:master' into master
This commit is contained in:
commit
0e7a9d0d24
@ -126,7 +126,7 @@ repos:
|
||||
|
||||
# Check static types with mypy
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: "v0.971"
|
||||
rev: "v0.981"
|
||||
hooks:
|
||||
- id: mypy
|
||||
args: []
|
||||
|
@ -2022,14 +2022,20 @@ public:
|
||||
detail::list_iterator end() const { return {*this, PyList_GET_SIZE(m_ptr)}; }
|
||||
template <typename T>
|
||||
void append(T &&val) /* py-non-const */ {
|
||||
PyList_Append(m_ptr, detail::object_or_cast(std::forward<T>(val)).ptr());
|
||||
if (PyList_Append(m_ptr, detail::object_or_cast(std::forward<T>(val)).ptr()) != 0) {
|
||||
throw error_already_set();
|
||||
}
|
||||
}
|
||||
template <typename IdxType,
|
||||
typename ValType,
|
||||
detail::enable_if_t<std::is_integral<IdxType>::value, int> = 0>
|
||||
void insert(const IdxType &index, ValType &&val) /* py-non-const */ {
|
||||
PyList_Insert(
|
||||
m_ptr, ssize_t_cast(index), detail::object_or_cast(std::forward<ValType>(val)).ptr());
|
||||
if (PyList_Insert(m_ptr,
|
||||
ssize_t_cast(index),
|
||||
detail::object_or_cast(std::forward<ValType>(val)).ptr())
|
||||
!= 0) {
|
||||
throw error_already_set();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user