Skip to content

Commit ff3a687

Browse files
dnicolodirgommers
authored andcommitted
ENH: do not populate defaultdict on lookup
Looking up keys in a default dict adds these keys to the dictionary with their default value when they are not present. This is an issue if the lookup happens while the dictionary is being iterated. Avoid it.
1 parent ac8256a commit ff3a687

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mesonpy/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,12 @@ def _wheel_files(self) -> DefaultDict[str, List[Tuple[pathlib.Path, str]]]:
272272

273273
@property
274274
def _has_internal_libs(self) -> bool:
275-
return bool(self._wheel_files['mesonpy-libs'])
275+
return bool(self._wheel_files.get('mesonpy-libs'))
276276

277277
@property
278278
def _has_extension_modules(self) -> bool:
279279
# Assume that all code installed in {platlib} is Python ABI dependent.
280-
return bool(self._wheel_files['platlib'])
280+
return bool(self._wheel_files.get('platlib'))
281281

282282
@property
283283
def normalized_name(self) -> str:

0 commit comments

Comments
 (0)