diff options
Diffstat (limited to 'sources/shiboken6/libshiboken/helper.cpp')
-rw-r--r-- | sources/shiboken6/libshiboken/helper.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sources/shiboken6/libshiboken/helper.cpp b/sources/shiboken6/libshiboken/helper.cpp index 3f8d7b8d0..02f8177f3 100644 --- a/sources/shiboken6/libshiboken/helper.cpp +++ b/sources/shiboken6/libshiboken/helper.cpp @@ -141,6 +141,10 @@ debugPyTypeObject::debugPyTypeObject(const PyTypeObject *o) : m_object(o) { } +debugPyBuffer::debugPyBuffer(const Py_buffer &b) : m_buffer(b) +{ +} + std::ostream &operator<<(std::ostream &str, const debugPyTypeObject &o) { str << "PyTypeObject("; @@ -157,6 +161,18 @@ std::ostream &operator<<(std::ostream &str, const debugPyObject &o) return str; } +std::ostream &operator<<(std::ostream &str, const debugPyBuffer &b) +{ + str << "PyBuffer(buf=" << b.m_buffer.buf << ", len=" + << b.m_buffer.len << ", itemsize=" << b.m_buffer.itemsize + << ", readonly=" << b.m_buffer.readonly << ", ndim=" << b.m_buffer.ndim; + if (b.m_buffer.format) + str << ", format=\"" << b.m_buffer.format << '"'; + str << ", shape=" << b.m_buffer.shape << ", strides=" << b.m_buffer.strides + << ", suboffsets=" << b.m_buffer.suboffsets << ')'; + return str; +} + #ifdef _WIN32 // Converts a Unicode string to a string encoded in the Windows console's // code page via wchar_t for use with argv (PYSIDE-1425). |