Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Django 5.0 with PyPy 3.10 #708

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Darjus Loktevic <darjus@amazon.com>
David Fischer <david.fischer.ch@gmail.com>
David Ziegler <david.ziegler@gmail.com>
Diego Andres Sanabria Martin <diegueus9@gmail.com>
Dima Doroshev <dima@doroshev.com>
Dmitriy Krasilnikov <krasilnikov.d.o@gmail.com>
Donald Stufft <donald.stufft@gmail.com>
Eldon Stegall
Expand Down
3 changes: 2 additions & 1 deletion Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

Next
====
- Formally support Python 3.12.
- Formally support Python 3.12 and PyPy 3.10.
- Formally support Django 5.0.

.. _version-2.5.0:

Expand Down
8 changes: 4 additions & 4 deletions django_celery_beat/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@
SECONDS = 'seconds'
MICROSECONDS = 'microseconds'

PERIOD_CHOICES = (
PERIOD_CHOICES = [
(DAYS, _('Days')),
(HOURS, _('Hours')),
(MINUTES, _('Minutes')),
(SECONDS, _('Seconds')),
(MICROSECONDS, _('Microseconds')),
)
]

SINGULAR_PERIODS = (
SINGULAR_PERIODS = [
(DAYS, _('Day')),
(HOURS, _('Hour')),
(MINUTES, _('Minute')),
(SECONDS, _('Second')),
(MICROSECONDS, _('Microsecond')),
)
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!!

Can we please change this only on PyPy and in a way that allows it to be removed after PyPy v7.3.14 is released?

Tuples take less memory and signal to the reader that these values should normally not be modified at runtime. Also, given comments in the first few episodes of the core.py podcast, tuples should perform better in the multi-GIL world of Python 3.13+.

Something like...

import platform

if platform.python_implementation() == "PyPy":  # Workaround for PyPy < v7.3.14
    PERIOD_CHOICES = list(PERIOD_CHOICES)
    SINGULAR_PERIODS = list(SINGULAR_PERIODS)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't make sense, since Django always converts them to lists under the hood

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then why is there a bug at all?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's all about test_models_match_migrations that was failing in your PR https://github.com/celery/django-celery-beat/actions/runs/7267638477/job/19801878411?pr=705#step:6:2073

I think the PR description should cover the problem pretty well. If it's unclear, let me know and I'll fix it.


SOLAR_SCHEDULES = [
("dawn_astronomical", _("Astronomical dawn")),
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ envlist =
py310-django{32,41,42,50}
py311-django{41,42,50}
py312-django{41,42,50}
pypy3-django{32,41,42}
pypy3-django{32,41,42,50}
flake8
apicheck
linkcheck
Expand Down