Open overfl0 opened 7 years ago
It's been quite some time since I looked at this code.
The "deep copy" here allows the __reload__()
function to receive a copy of the original module that can be used to restore state. I can't remember why I made it a "deep" copy (imported modules and all) rather than a "shallow" copy, which could provide just the top-level attributes. Perhaps the latter doesn't work if those attributes references imported types?
That being said, it seems reasonable to specifically exclude logging
from the deep copy if that's the true source of your problem, but I'd also like to find a more general solution before closing out this issue.
Hello, I'm having an issue when I'm trying to reload a module that has the
__reload__
function defines. I've narrowed the problem to even just having `logging' imported:module.py:
Run.py:
I think the issue seems to be with deepcopying the logginng module. Should it also be deleted in
_deepcopy_module_dict()
as you're doing with__builtins__
? (just a wild guess)The errors seem to differ each time I run
run.py
. I'm getting one of those on python 3.5:TypeError: cannot serialize '_io.TextIOWrapper' object
AttributeError: 'NoneType' object has no attribute 'update'
TypeError: cannot create 'sys.version_info' instances
TypeError: cannot create 'sys.flags' instances
TypeError: can't pickle _thread.lock objects
Example stacktrace: