From 986489a3b4696e0a8b5cf187d463abab5194e948 Mon Sep 17 00:00:00 2001 From: Benjamin Reese Date: Tue, 15 Oct 2024 13:02:37 -0700 Subject: [PATCH] Better bytearray allocation --- src/rogue/interfaces/stream/Frame.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rogue/interfaces/stream/Frame.cpp b/src/rogue/interfaces/stream/Frame.cpp index 7bf375361..9c6f12ba7 100644 --- a/src/rogue/interfaces/stream/Frame.cpp +++ b/src/rogue/interfaces/stream/Frame.cpp @@ -376,7 +376,8 @@ bp::object ris::Frame::readBytearrayPy(uint32_t offset) { uint32_t size = getPayload(); // Create a Python bytearray to hold the data - boost::python::object byteArray = boost::python::eval("bytearray")(size - offset); + bp::object byteArray(bp::handle<>(PyByteArray_FromStringAndSize(nullptr, size - offset))); + this->readPy(byteArray, offset);