Skip to content

fix: preserve FakeDate == datetime on Python 3.13+#599

Open
l46983284-cpu wants to merge 1 commit into
spulec:masterfrom
l46983284-cpu:fix/fakedate-eq-datetime-py313
Open

fix: preserve FakeDate == datetime on Python 3.13+#599
l46983284-cpu wants to merge 1 commit into
spulec:masterfrom
l46983284-cpu:fix/fakedate-eq-datetime-py313

Conversation

@l46983284-cpu

Copy link
Copy Markdown

Summary

Python 3.13 changed date == datetime so date.__eq__(datetime) returns NotImplemented. freezegun's FakeDate previously compared date components only; that broke on 3.13+ (issue #568).

This restores the historical FakeDate == datetime behavior and adds a regression test.

Test plan

  • Reproduced on Python 3.13.14 in remote Daytona sandbox (assert failed before patch)
  • After patch: assert + pytest -k fakedate_equals_datetime PASS on 3.13.14

Fixes #568

Python 3.13 changed date/datetime equality so date.__eq__(datetime)
returns NotImplemented. freezegun FakeDate previously compared date
components only (issue spulec#568). Restore that behavior for FakeDate and
add a regression test.

Signed-off-by: Alex Chen <l46983284@gmail.com>
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.

datetime/FakeDate equality failure on 3.13

1 participant