From 8c685938226b570dbb741937c40fff19124e4c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Thu, 7 Aug 2025 18:39:19 +0200 Subject: [PATCH 1/2] Add missing check --- src/RecordComponent.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/RecordComponent.cpp b/src/RecordComponent.cpp index 9a5c2b6b04..a57f1d8f97 100644 --- a/src/RecordComponent.cpp +++ b/src/RecordComponent.cpp @@ -272,7 +272,7 @@ void RecordComponent::flush( { // The check for !written() is technically not needed, just // defensive programming against internal bugs that go on us. - if (!written() && rc.m_chunks.empty()) + if (!written() && rc.m_chunks.empty() && !rc.m_isConstant) { // No data written yet, just accessed the object so far without // doing anything @@ -283,7 +283,8 @@ void RecordComponent::flush( { throw error::WrongAPIUsage( "[RecordComponent] Must specify dataset type and extent " - "before flushing (see RecordComponent::resetDataset())."); + "before flushing or setting a constant value (see " + "RecordComponent::resetDataset())."); } } if (!containsAttribute("unitSI")) From a8ffae327470eebb1aaffd8d6ad35196e5dd10f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Thu, 7 Aug 2025 18:49:59 +0200 Subject: [PATCH 2/2] Fix test --- test/python/unittest/API/APITest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/python/unittest/API/APITest.py b/test/python/unittest/API/APITest.py index f7514d8c2c..24dfec4051 100644 --- a/test/python/unittest/API/APITest.py +++ b/test/python/unittest/API/APITest.py @@ -109,6 +109,8 @@ def refcountingCreateData(self): for dim in ["x", "y"]: # Do not bother with a positionOffset position_offset = e["positionOffset"][dim] + position_offset.reset_dataset( + io.Dataset(np.dtype("int"), [100])) position_offset.make_constant(0) position = e["position"][dim]