Repository navigation
Set sysconfig TZPATH on POSIX so zoneinfo finds system time zones - #1207
Merged
Merged
Conversation
zoneinfo falls back to sysconfig's TZPATH, which CPython's configure sets to /usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/etc/zoneinfo by default. GraalPy did not define it, so zoneinfo.TZPATH was empty and ZoneInfo needed the tzdata package. Windows keeps an empty TZPATH. Fixes oracle#1206 Signed-off-by: Graeme Rocher <graeme.rocher@oracle.com>
msimacek
approved these changes
Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1206.
zoneinfofalls back tosysconfig.get_config_var("TZPATH")whenPYTHONTZPATHisn't set. CPython'sconfiguresets that variable to its--with-tzpathdefault,/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/etc/zoneinfo. GraalPy defines it only on Windows (as''), so on Linux and macOSzoneinfo.TZPATHis()and system time zones are never found.This change sets the same default in
_sysconfig._update_posix_varsfor non-Windows platforms. It uses_setdefault, so aTZPATHin the generated_sysconfigdatastill wins. The new test intest_sysconfig.pychecks the config var andzoneinfo.TZPATHin a fresh interpreter withoutPYTHONTZPATH.Verified on GraalPy 25.4.4 (macOS):
sysconfig.get_config_var('TZPATH')isNoneandzoneinfo.TZPATHis()today. With this search path,ZoneInfo('Europe/Berlin')resolves from/usr/share/zoneinfo. I checked the new_update_posix_varsoutput directly, but I haven't run the fullmxtest suite.