datetime.strptime without a year fails on Feb 29

SriramRajagopalan · GitHub

BPO

26460

Nosy

@gpshead

,

@abalkin

,

@pganssle

,

@tirkarthi

,

@nickzoic

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more detailsGitHub fields:

assignee=Noneclosed_at=Nonecreated_at=<Date2016-02-29.18:02:35.000>labels= ['3.7', '3.8', 'type-feature', 'library'] title='datetime.strptime without a year fails on Feb 29'updated_at=<Date2020-03-03.17:16:20.440>user='https://bugs.python.org/SriramRajagopalan'bugs.python.org fields:

activity=<Date2020-03-03.17:16:20.440>actor='nickzoic'assignee='none'closed=Falseclosed_date=Nonecloser=Nonecomponents= ['Library (Lib)'] creation=<Date2016-02-29.18:02:35.000>creator='Sriram Rajagopalan'dependencies= [] files= [] hgrepos= [] issue_num=26460keywords= [] message_count=13.0messages= ['261014', '261024', '261027', '261028', '261033', '343085', '363123', '363202', '363215', '363217', '363223', '363257', '363280'] nosy_count=8.0nosy_names= ['gregory.p.smith', 'belopolsky', 'polymorphm', 'Sriram Rajagopalan', 'p-ganssle', 'xtreak', '[email protected]', 'nickzoic'] pr_nums= [] priority='normal'resolution=Nonestage=Nonestatus='open'superseder=Nonetype='enhancement'url='https://bugs.python.org/issue26460'versions= ['Python 3.6', 'Python 3.7', 'Python 3.8']remaining TODO list:

turn %e into an error in 3.17.

Linked PRs

gh-70647: Better promote how to safely parse yearless dates in datetime. #116179

gh-70647: Add detail to error message when parsing a bad day of month. #116184

GH-70647: Deprecate strptime day of month parsing without a year present to avoid leap-year bugs #117107

gh-70647: Raise a more informative error for when date is out of range #131335

[3.12] gh-70647: update docs to mention the datetime 1900 year default 2/29 issue #131534

[3.14] gh-70647: Better promote how to safely parse yearless dates in datetime. (GH-116179) #143037

[3.13] gh-70647: Better promote how to safely parse yearless dates in datetime. (GH-116179) #143038

GH-70647: Remove support for %d (and deprecate for %e) without year in strptime() #144570