From ad3dda094efaabbcba76f31447a3216007b3ef9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 1 Jan 2026 16:43:32 +0100 Subject: [PATCH] python: add TODOs for converting more asserts to Python exceptions. Currently not possible to do as the image data size utils are in private headers. The whole Image internals are due for a rework anyway, so just wait until that's done. --- src/python/magnum/magnum.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/python/magnum/magnum.cpp b/src/python/magnum/magnum.cpp index 2d49cfe..d80bf5c 100644 --- a/src/python/magnum/magnum.cpp +++ b/src/python/magnum/magnum.cpp @@ -93,9 +93,13 @@ template void imageView(py::class_>& c) { c /* Constructors */ .def(py::init([](const PixelStorage& storage, PixelFormat format, const typename PyDimensionTraits::VectorType& size, const Containers::ArrayView& data) { + /** @todo check and fire an exception for too small data array, + once that's available in a non-internal API */ return pyImageViewHolder(T{storage, format, size, data}, pyObjectHolderFor(data).owner); }), "Constructor") .def(py::init([](PixelFormat format, const typename PyDimensionTraits::VectorType& size, const Containers::ArrayView& data) { + /** @todo check and fire an exception for too small data array, + once that's available in a non-internal API */ return pyImageViewHolder(T{format, size, data}, pyObjectHolderFor(data).owner); }), "Constructor") .def(py::init([](const PixelStorage& storage, PixelFormat format, const typename PyDimensionTraits::VectorType& size) { @@ -183,6 +187,8 @@ template void compressedImageView(py::class_>& return T{format, size}; }), "Construct an empty view") .def(py::init([](CompressedPixelFormat format, const typename PyDimensionTraits::VectorType& size, const Containers::ArrayView& data) { + /** @todo check and fire an exception for too small data array, + once that's available in a non-internal API */ return pyImageViewHolder(T{format, size, data}, pyObjectHolderFor(data).owner); }), "Constructor") .def(py::init([](CompressedImage& image) {