You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all,
While introspecting test_dynamic_module for #192, I wrote a script that
dumps a dynamic module,
changes a global variable inside
finally re-load the dumped module.
importimpimportcloudpickleimporttextwrapimportsysimportpicklemod=imp.new_module('mod')
code='''x = 1'''exec(textwrap.dedent(code), mod.__dict__)
# first, dump the modulefileobj=cloudpickle.dumps(mod)
# change the mod's global variable xmod.x=2# create child-process-like process environnement where# mod is already loaded with the modified variable xsys.modules['mod'] =mod# finally, re-load the dynamic modulemod2=pickle.loads(fileobj)
# this fails for nowassertmod2.x==mod.x
The modified global variable gets overriden. I wonder if this is global behavior, or it needs to be changed.
Using Python 3.7.0, cloudpickle==0.5.5
The text was updated successfully, but these errors were encountered:
Hi all,
While introspecting
test_dynamic_module
for #192, I wrote a script thatThe modified global variable gets overriden. I wonder if this is global behavior, or it needs to be changed.
Using Python 3.7.0, cloudpickle==0.5.5
The text was updated successfully, but these errors were encountered: