Skip to content

datetime.now(timezone.utc) segfaults with Intel oneAPI v2022.1.2 and higher since Python 3.9  #106424

@haampie

Description

@haampie

I've bisected this to 37fcbb6 (first "bad" commit)

The following Python code is a minimal reproducer:

from datetime import datetime, timezone
datetime.now(timezone.utc)

When compiling Python with any of the following Intel compilers:

2023.2.0
2023.1.0
2023.0.0
2022.2.1

Any version 3.9, 3.10, 3.11 causes a segfault in add_datetime_timedelta / timezone_fromutc where for some reason with -O1 optimizations (edit: and higher) the self->offset / delta pointer is a NULL.

Program received signal SIGSEGV, Segmentation fault.
0x00007f303942ef0c in add_datetime_timedelta (date=0x7f30394d7000, delta=0x0, factor=1) at Modules/_datetimemodule.c:5373
5373	    int day = GET_DAY(date) + GET_TD_DAYS(delta) * factor;

Adding -fno-strict-aliasing does not prevent this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions