Re: F39 Change Proposal: Allow Removal of tzdata (System-Wide)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/27/23 02:00, Miro Hrončok wrote:
On 26. 06. 23 20:24, Fabio Valentini wrote:
On Mon, Jun 26, 2023 at 8:10 PM Miro Hrončok <mhroncok@xxxxxxxxxx> wrote:


(snip)

---

The current problem with Python without tzdata is:

=======================================================================
  >>> from zoneinfo import ZoneInfo
  >>> ZoneInfo("Europe/Prague")
Traceback (most recent call last):
    ...
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key Europe/Prague'
=======================================================================

Not that ZoneInfo("UTC") also fails:

=======================================================================
  >>> ZoneInfo("UTC")
Traceback (most recent call last):
...
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key UTC'
=======================================================================

So we would need to patch Python to detect missing tzdata and report something
like:

   ZoneInfoNotInstalledError: 'No time zone information installed on the system,
you can only use UTC'

We would also need to ensure UTC work even without tzdata installed.

I would be reluctant to carry this as a downstream-only patch. And the upstream
window for changes like this has already closed for Python 3.12.

Does this mean that tzdata needs to be present for doing datetime /
timezone calculations at runtime with the zoneinfo module?

Yes. That's why it is Required and not Recommended.

Would this Change require that all Python programs that use this
module add "Requires: tzdata"? I don't think that would be a
reasonable change.

Either that or adapt their code to fail in a reasonable way. Both sound quite unreasonable to me.


The case with LANG seems analogous.  If LANG is unset, then any software
should use the default LANG=C, and should work acceptably well.
If TZ is unset (or there is no other indication
of which timezone to use, or if the timezone data is unavailable)
then any software should use UTC, and should work acceptably well.
(In formal scientific work then UTC *is* the default timezone.)
For either unset LANG or missing timezone info, it is optional
for an application to emit a polite informative message *once* on stderr.
In particular, the zoneinfo module should handle all the details
so that individual applications need not bother.
.
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux