diff options
author | Diego Roversi <diegor@tiscali.it> | 2019-09-08 22:05:57 +0200 |
---|---|---|
committer | Diego Roversi <diegor@tiscali.it> | 2019-09-08 22:05:57 +0200 |
commit | c23b138ed72d794521b19ff7d8076b32b0b7bf46 (patch) | |
tree | c8e82a4ca4da05ba1ad28d4ff64a157bc1eb7952 /bubbob/statesaver.py | |
parent | 1d9925c287b318ec21343e2682b51ab6a36ae8db (diff) |
2to3
Diffstat (limited to 'bubbob/statesaver.py')
-rw-r--r-- | bubbob/statesaver.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/bubbob/statesaver.py b/bubbob/statesaver.py index 85d3425..72be9cd 100644 --- a/bubbob/statesaver.py +++ b/bubbob/statesaver.py @@ -27,7 +27,7 @@ def copy_custom_instance(x, memo): except KeyError: y = x.inst_build() memo[id(x)] = y - for key, value in x.__dict__.items(): + for key, value in list(x.__dict__.items()): y.__dict__[key] = copyrec(value, memo) return y @@ -50,25 +50,25 @@ def copy_dict(x, memo): except KeyError: y = {} memo[id(x)] = y - for key, value in x.items(): + for key, value in list(x.items()): y[copyrec(key, memo)] = copyrec(value, memo) return y def copy_function(x, memo): - if not x.func_defaults: + if not x.__defaults__: return x # not copied try: return memo[id(x)] except KeyError: - y = types.FunctionType(x.func_code, x.func_globals, x.func_name) + y = types.FunctionType(x.__code__, x.__globals__, x.__name__) memo[id(x)] = y - y.func_defaults = copyrec(x.func_defaults, memo) + y.__defaults__ = copyrec(x.__defaults__, memo) return y def copy_method(x, memo): - return types.MethodType(copyrec(x.im_func, memo), - copyrec(x.im_self, memo), - x.im_class) + return types.MethodType(copyrec(x.__func__, memo), + copyrec(x.__self__, memo), + x.__self__.__class__) def copy_generator(x, memo): try: |