| 162 | |
| 163 | private: |
| 164 | void _read(char* data, size_t n) { |
| 165 | nb::object memview = |
| 166 | nb::steal<nb::object>(PyMemoryView_FromMemory(data, n, PyBUF_WRITE)); |
| 167 | if (!memview.is_valid()) { |
| 168 | throw std::runtime_error("[load] Failed to create memoryview for read"); |
| 169 | } |
| 170 | nb::object bytes_read = readinto_func_(memview); |
| 171 | |
| 172 | if (bytes_read.is_none() || nb::cast<size_t>(bytes_read) < n) { |
| 173 | throw std::runtime_error("[load] Failed to read from python stream"); |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | nb::object pyistream_; |
| 178 | nb::object readinto_func_; |
nothing calls this directly
no outgoing calls
no test coverage detected