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

Method memoryview

include/pybind11/pytypes.h:2406–2416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2404 use ``memoryview(const object& obj)`` instead of this constructor.
2405 \endrst */
2406 explicit memoryview(const buffer_info &info) {
2407 if (!info.view()) {
2408 pybind11_fail("Prohibited to create memoryview without Py_buffer");
2409 }
2410 // Note: PyMemoryView_FromBuffer never increments obj reference.
2411 m_ptr = (info.view()->obj) ? PyMemoryView_FromObject(info.view()->obj)
2412 : PyMemoryView_FromBuffer(info.view());
2413 if (!m_ptr) {
2414 pybind11_fail("Unable to create memoryview from buffer descriptor");
2415 }
2416 }
2417
2418 /** \rst
2419 Creates ``memoryview`` from static buffer.

Callers

nothing calls this directly

Calls 1

viewMethod · 0.45

Tested by

no test coverage detected