File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ Changelog follow https://keepachangelog.com/ format.
10
10
11
11
* ` ecolab.adhoc ` :
12
12
* Better error message for adhoc invalidate with ` epy.reraise `
13
+ * Fix crash when importing module not supporting weak_ref
13
14
14
15
## [ 1.12.2] - 2025-03-10
15
16
Original file line number Diff line number Diff line change @@ -180,7 +180,13 @@ class _ModuleRefs:
180
180
181
181
def save_module (self , module : types .ModuleType ) -> None :
182
182
"""Save reference on all previous modules/objects."""
183
- self .modules .append (weakref .ref (module ))
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 )
184
190
185
191
for name , old_obj in module .__dict__ .items ():
186
192
# Only update objects part of the module (filter other imported symbols)
You can’t perform that action at this time.
0 commit comments