| 219 | } |
| 220 | |
| 221 | PyObject* vector_get_item(vector_t* self, Py_ssize_t pos) |
| 222 | { |
| 223 | if (pos < 0) |
| 224 | pos += self->impl.size(); |
| 225 | if (pos < 0 || pos >= (Py_ssize_t) self->impl.size()) { |
| 226 | PyErr_Format(PyExc_IndexError, "Index out of range: %zi", pos); |
| 227 | return nullptr; |
| 228 | } |
| 229 | auto r = self->impl[pos]; |
| 230 | return r.release(); |
| 231 | } |
| 232 | |
| 233 | PyObject* vector_subscript(vector_t* self, PyObject* item) |
| 234 | { |
no test coverage detected