File tree 2 files changed +8
-3
lines changed
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 1
1
1.2.3
2
2
=====
3
3
4
+ - Fix a bug when a thread imports a module while cloudpickle iterates
5
+ over the module list
6
+ ([ PR #322 ] ( https://github.com/cloudpipe/cloudpickle/pull/322 ) ).
7
+
4
8
1.2.2
5
9
=====
6
10
Original file line number Diff line number Diff line change @@ -151,9 +151,10 @@ def _whichmodule(obj, name):
151
151
module_name = getattr (obj , '__module__' , None )
152
152
if module_name is not None :
153
153
return module_name
154
- # Protect the iteration by using a list copy of sys.modules against dynamic
155
- # modules that trigger imports of other modules upon calls to getattr.
156
- for module_name , module in list (sys .modules .items ()):
154
+ # Protect the iteration by using a copy of sys.modules against dynamic
155
+ # modules that trigger imports of other modules upon calls to getattr or
156
+ # other threads importing at the same time.
157
+ for module_name , module in sys .modules .copy ().items ():
157
158
if module_name == '__main__' or module is None :
158
159
continue
159
160
try :
You can’t perform that action at this time.
0 commit comments