is this the fault of import_fresh_module or pickle?
Hello,
I'm still having some struggles with the interaction between pickle and
import overriding with import_fresh_module.
_elementtree.TreeBuilder can't be pickled at this point. When I do this:
from test.support import import_fresh_module
import pickle
P = import_fresh_module('xml.etree.ElementTree', blocked=['_elementtree'])
tb = P.TreeBuilder()
print(pickle.dumps(tb))
Everything works fine. However, if I add import_fresh_module for the C
module:
from test.support import import_fresh_module
import pickle
C = import_fresh_module('xml.etree.ElementTree', fresh=['_elementtree'])
P = import_fresh_module('xml.etree.ElementTree', blocked=['_elementtree'])
tb = P.TreeBuilder()
print(pickle.dumps(tb))
I get an error from pickle.dumps:
Traceback (most recent call last):
File "mix_c_py_etree.py", line 10, in <module>
print(pickle.dumps(tb))
_pickle.PicklingError: Can't pickle
participants (4)
-
Eli Bendersky
-
Nick Coghlan
-
R. David Murray
-
Stefan Krah