#35683: django.utils.timezone.make_naive can underflow for timezones close to
datetime.min
-------------------------------------+-------------------------------------
     Reporter:  Liam DeVoe           |                    Owner:  Shubham
                                     |  Singh Sugara
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  5.1
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Liam DeVoe):

 I half expected this ticket to be wontfix when I opened it :). Here's one
 sane alternative I can think of: if you're converting to naive solely for
 serializing to the db, and when you deserialize from the db you make it tz
 aware again, then the only time it's out of bounds for the
 serialization/storage portion. But you control the serialization format,
 so you could extend the limits by 24 hours in each direction to
 accommodate those overflows, relying on the invariant that they will be
 made immediately tz aware and thus in bounds before reaching the user.

 I'm not familiar with django internals, so this may not be acceptable or
 the assumed invariants may not be correct - that's up to you guys. I agree
 that silently capping is not a good idea. Possibly this should just be
 wontifx'd but documented; it does seem surprising to a user that I cannot
 store an in-bounds tz aware datetime, because there is no reason to expect
 it is converted to a naive datetime.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35683#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107019177592b62-e3b218cb-390a-4e2e-bf6d-4bb416f6571f-000000%40eu-central-1.amazonses.com.

Reply via email to