Skip to content

Commit ab06a5d

Browse files
don't insert name attributes into single part files (#2301)
Signed-off-by: Peter Hillman <peterh@wetafx.co.nz> Co-authored-by: Cary Phillips <cary@ilm.com>
1 parent 6926c63 commit ab06a5d

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/wrappers/python/PyOpenEXR.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,14 +1065,14 @@ PyFile::write(const char* outfilename)
10651065

10661066
Header header;
10671067

1068-
if (P.name().empty() && parts.size() > 1)
1068+
if (!P.name().empty())
1069+
header.setName (P.name());
1070+
else if (parts.size() > 1)
10691071
{
10701072
std::stringstream n;
10711073
n << "Part" << part_index;
10721074
header.setName (n.str());
10731075
}
1074-
else
1075-
header.setName (P.name());
10761076

10771077
//
10781078
// Add attributes from the py::dict to the output header

src/wrappers/python/tests/test_unittest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,8 @@ def test_write_half(self):
324324
# Verify reading it back gives the same data
325325
with OpenEXR.File(outfilename, separate_channels=True) as infile:
326326
compare_files (infile, outfile)
327+
if "name" in infile.header():
328+
raise Exception(f"name attribute was added to single part half file")
327329

328330
os.remove(outfilename)
329331

0 commit comments

Comments
 (0)