Skip to content

Correct CmsProfile creation_date month#9804

Open
radarhere wants to merge 1 commit into
python-pillow:mainfrom
radarhere:creation_date
Open

Correct CmsProfile creation_date month#9804
radarhere wants to merge 1 commit into
python-pillow:mainfrom
radarhere:creation_date

Conversation

@radarhere

Copy link
Copy Markdown
Member

Resolves #9801

Pillow/src/_imagingcms.c

Lines 1029 to 1038 in 8f86212

struct tm ct;
result = cmsGetHeaderCreationDateTime(self->profile, &ct);
if (!result) {
Py_RETURN_NONE;
}
return PyDateTime_FromDateAndTime(
1900 + ct.tm_year, ct.tm_mon, ct.tm_mday, ct.tm_hour, ct.tm_min, ct.tm_sec, 0
);

In tm, month ranges from 0-11, but PyDateTime_FromDateAndTime leads to datetime.datetime, which requires 1 <= month <= 12. So this PR adds 1 to the month.

This updates the tested creation date of Tests/icc/sRGB_IEC61966-2-1_black_scaled.icc, now matching what I see in macOS ColorSync Utility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ValueError: month must be in 1..12

1 participant