Skip to content

Commit 2a2b782

Browse files
committed
Merge tag 'v3.8.2'
2 parents 61fcac1 + d17d6e4 commit 2a2b782

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ v3.9.0
1919
config, resulting in a ~20% performance improvement when
2020
loading entry points.
2121

22+
v3.8.2
23+
======
24+
25+
* #293: Re-enabled lazy evaluation of path lookup through
26+
a FreezableDefaultDict.
27+
2228
v3.8.1
2329
======
2430

importlib_metadata/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import contextlib
1616
import collections
1717

18-
from ._collections import freezable_defaultdict
18+
from ._collections import FreezableDefaultDict
1919
from ._compat import (
2020
NullFinder,
2121
Protocol,
@@ -710,8 +710,8 @@ class Lookup:
710710
def __init__(self, path: FastPath):
711711
base = os.path.basename(path.root).lower()
712712
base_is_egg = base.endswith(".egg")
713-
self.infos = freezable_defaultdict(list)
714-
self.eggs = freezable_defaultdict(list)
713+
self.infos = FreezableDefaultDict(list)
714+
self.eggs = FreezableDefaultDict(list)
715715

716716
for child in path.children():
717717
low = child.lower()

importlib_metadata/_collections.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import collections
22

33

4-
class freezable_defaultdict(collections.defaultdict):
4+
# from jaraco.collections 3.3
5+
class FreezableDefaultDict(collections.defaultdict):
56
"""
6-
Mix-in to freeze a defaultdict.
7+
Often it is desirable to prevent the mutation of
8+
a default dict after its initial construction, such
9+
as to prevent mutation during iteration.
710
8-
>>> dd = freezable_defaultdict(list)
11+
>>> dd = FreezableDefaultDict(list)
912
>>> dd[0].append('1')
1013
>>> dd.freeze()
1114
>>> dd[1]

0 commit comments

Comments
 (0)