From 3000594e929aea768fe0dd2437e0722ecfa2dbdc Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 6 Aug 2025 17:05:41 -0500 Subject: [PATCH] gh-84683: Check `/share/zoneinfo` for zoneinfo files on Windows (GH-28495) --- Lib/sysconfig/__init__.py | 8 +++++++- .../Library/2021-09-21-17-17-29.gh-issue-84683.wDSRsG.rst | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2021-09-21-17-17-29.gh-issue-84683.wDSRsG.rst diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py index 49e0986517ce..c583b74ce54f 100644 --- a/Lib/sysconfig/__init__.py +++ b/Lib/sysconfig/__init__.py @@ -412,7 +412,13 @@ def _init_non_posix(vars): vars['EXE'] = '.exe' vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable)) - vars['TZPATH'] = '' + # No standard path exists on Windows for this, but we'll check + # whether someone is imitating a POSIX-like layout + check_tzpath = os.path.join(vars['prefix'], 'share', 'zoneinfo') + if os.path.exists(check_tzpath): + vars['TZPATH'] = check_tzpath + else: + vars['TZPATH'] = '' # # public APIs diff --git a/Misc/NEWS.d/next/Library/2021-09-21-17-17-29.gh-issue-84683.wDSRsG.rst b/Misc/NEWS.d/next/Library/2021-09-21-17-17-29.gh-issue-84683.wDSRsG.rst new file mode 100644 index 000000000000..66f76bda6ad7 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-09-21-17-17-29.gh-issue-84683.wDSRsG.rst @@ -0,0 +1 @@ +:mod:`zoneinfo`: Check in ``/share/zoneinfo`` for data files on Windows -- 2.47.3