Skip to content

./Modules/_datetimemodule.c:290: days_before_year: Assertion `year >= 1' failed. #117534

Closed
@Vlad4896

Description

@Vlad4896

Crash report

What happened?

Python terminates with core dumped on the following test:

import datetime

y = datetime.datetime.fromisoformat('0000W25')
print(y)

The test result:

python: ./Modules/_datetimemodule.c:290: days_before_year: Assertion `year >= 1' failed.
Aborted (core dumped)

The issue happened due to lack of checking for input parameters in iso_to_ymd().
The 'iso_year' input parameter should be checked to fix the issue.

CPython versions tested on:

3.11, 3.12, CPython main branch

Operating systems tested on:

Linux

Output from running 'python -VV' on the command line:

Python 3.13.0a5+ (heads/main:dc54714044, Apr 4 2024, 12:28:42) [GCC 11.4.0]

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions