MCPcopy Create free account
hub / github.com/ml-explore/mlx-data / underflow

Method underflow

python/src/wrap.h:67–85  ·  view source on GitHub ↗

Means the stream ran out so we need to read more or return eof

Source from the content-addressed store, hash-verified

65 protected:
66 // Means the stream ran out so we need to read more or return eof
67 virtual int underflow() override {
68 // If we didn't ran out then simply return the value under the current
69 // pointer.
70 if (gptr() != egptr()) {
71 return *gptr();
72 } else {
73 py::gil_scoped_acquire gil;
74
75 // Ok we ran out so read buffer_size_ things into the buffer and reset
76 // the pointers.
77 int n_read = readinto_buffer();
78 setg(buffer_, buffer_, buffer_ + n_read);
79 if (n_read > 0) {
80 return *gptr();
81 } else {
82 return traits_type::eof();
83 }
84 }
85 }
86
87 // Seek the underlying python "file" to the requested position.
88 virtual pos_type seekpos(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected