MCPcopy Create free account
hub / github.com/pybind/pybind11 / pythonbuf

Method pythonbuf

include/pybind11/iostream.h:124–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122 static constexpr size_t minimum_buffer_size = 4;
123
124 explicit pythonbuf(const object &pyostream, size_t buffer_size = 1024)
125 : buf_size(buffer_size < minimum_buffer_size // ternary avoids C++14 std::max ODR-use of
126 // static constexpr
127 ? minimum_buffer_size
128 : buffer_size),
129 d_buffer(new char[buf_size]), pywrite(pyostream.attr("write")),
130 pyflush(pyostream.attr("flush")) {
131 setp(d_buffer.get(), d_buffer.get() + buf_size - 1);
132 }
133
134 pythonbuf(pythonbuf &&other) noexcept
135 : buf_size(other.buf_size), d_buffer(std::move(other.d_buffer)),

Callers

nothing calls this directly

Calls 3

moveFunction · 0.85
attrMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected