| 152 | } |
| 153 | |
| 154 | extern "C" void ImplStream_HoldResources(PyObject *stream, PyObject *resourceList) |
| 155 | { |
| 156 | try |
| 157 | { |
| 158 | py::list resList = ToObj<py::list>(resourceList); |
| 159 | |
| 160 | LockResources resVector; |
| 161 | |
| 162 | for (py::handle h : resList) |
| 163 | { |
| 164 | py::tuple t = h.cast<py::tuple>(); |
| 165 | if (t.size() != 2) |
| 166 | { |
| 167 | throw std::runtime_error("ResourcePerMode tuple must have two elements"); |
| 168 | } |
| 169 | |
| 170 | auto lockMode = ToLockMode(t[0].ptr()); |
| 171 | auto res = ToSharedObj<const Resource>(t[1].ptr()); |
| 172 | |
| 173 | resVector.emplace(lockMode, res); |
| 174 | } |
| 175 | |
| 176 | ToSharedObj<Stream>(stream)->holdResources(std::move(resVector)); |
| 177 | } |
| 178 | CATCH_RETURN_DEFAULT(, "Hold resources failed") |
| 179 | } |
| 180 | |
| 181 | extern "C" PyObject *ImplStream_GetCurrent() |
| 182 | { |
nothing calls this directly
no test coverage detected