Skip to content

Commit c1ce0d1

Browse files
gh-99138: Isolate _zoneinfo (#99218)
* Convert zone info type to heap type and add it to module state * Add global variables to module state
1 parent eb0c485 commit c1ce0d1

File tree

6 files changed

+539
-213
lines changed

6 files changed

+539
-213
lines changed

Doc/library/zoneinfo.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ The following class methods are also available:
241241
.. warning::
242242

243243
Invoking this function may change the semantics of datetimes using
244-
``ZoneInfo`` in surprising ways; this modifies process-wide global state
244+
``ZoneInfo`` in surprising ways; this modifies module state
245245
and thus may have wide-ranging effects. Only use it if you know that you
246246
need to.
247247

Lib/test/test_zoneinfo/test_zoneinfo.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,12 +1797,10 @@ def test_cache_location(self):
17971797
self.assertTrue(hasattr(py_zoneinfo.ZoneInfo, "_weak_cache"))
17981798

17991799
def test_gc_tracked(self):
1800-
# The pure Python version is tracked by the GC but (for now) the C
1801-
# version is not.
18021800
import gc
18031801

18041802
self.assertTrue(gc.is_tracked(py_zoneinfo.ZoneInfo))
1805-
self.assertFalse(gc.is_tracked(c_zoneinfo.ZoneInfo))
1803+
self.assertTrue(gc.is_tracked(c_zoneinfo.ZoneInfo))
18061804

18071805

18081806
@dataclasses.dataclass(frozen=True)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Apply :pep:`687` to :mod:`zoneinfo`. Patch by Erlend E. Aasland.

0 commit comments

Comments
 (0)