Skip to content

Commit 9c24c89

Browse files
committed
Define self._handle up-front to prevent warning in __del__
Since initialization failures happen (usually) in `get_handle`, the instance would not have a proper `self._handle` defined and fail on `__del__` which checks for this field's value.
1 parent cba6ebf commit 9c24c89

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

clr_loader/hostfxr.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
class DotnetCoreRuntime(Runtime):
1515
def __init__(self, runtime_config: Path, dotnet_root: Path, **params: str):
16+
self._handle = None
17+
1618
if _IS_SHUTDOWN:
1719
raise RuntimeError("Runtime can not be reinitialized")
1820

0 commit comments

Comments
 (0)