Skip to content

Commit 4f20798

Browse files
ConchylicultorThe etils Authors
authored and
The etils Authors
committed
Fix etils adhoc crash with module not supporting weakref
PiperOrigin-RevId: 738028483
1 parent 2980163 commit 4f20798

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

CHANGELOG.md

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Changelog follow https://keepachangelog.com/ format.
1010

1111
* `ecolab.adhoc`:
1212
* Better error message for adhoc invalidate with `epy.reraise`
13-
* Fix crash when importing module not supporting weak_ref
1413

1514
## [1.12.2] - 2025-03-10
1615

etils/ecolab/inplace_reload.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,7 @@ class _ModuleRefs:
180180

181181
def save_module(self, module: types.ModuleType) -> None:
182182
"""Save reference on all previous modules/objects."""
183-
try:
184-
weak_module = weakref.ref(module)
185-
except TypeError:
186-
# Some modules, like '_bcrypt.lib' raises:
187-
# TypeError: cannot create weak reference to '_cffi_backend.Lib' object
188-
return
189-
self.modules.append(weak_module)
183+
self.modules.append(weakref.ref(module))
190184

191185
for name, old_obj in module.__dict__.items():
192186
# Only update objects part of the module (filter other imported symbols)

0 commit comments

Comments
 (0)