In sage 9.2 & 9.0 deepcopying the lift_map from a residue field at a prime does not finish because of recursion error
sage: R.<x> = ZZ[]
sage: f = x^2-2
sage: K.<a> = NumberField(f)
sage: P = K(2).factor()[0][0]
sage: F = K.residue_field(P)
sage: m = F.lift_map()
sage: deepcopy(m)
gives
---------------------------------------------------------------------------
RecursionError Traceback (most recent call last)
<ipython-input-26-c84bb92e2658> in <module>()
----> 1 deepcopy(m)
/home/sage/sage/local/lib/python3.7/copy.py in deepcopy(x, memo, _nil)
178 y = x
179 else:
--> 180 y = _reconstruct(x, memo, *rv)
181
182 # If is its own copy, don't memoize.
/home/sage/sage/local/lib/python3.7/copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
272 if deep and args:
273 args = (deepcopy(arg, memo) for arg in args)
--> 274 y = func(*args)
275 if deep:
276 memo[id(x)] = y
/home/sage/sage/local/lib/python3.7/copy.py in <genexpr>(.0)
271 deep = memo is not None
272 if deep and args:
--> 273 args = (deepcopy(arg, memo) for arg in args)
274 y = func(*args)
275 if deep:
/home/sage/sage/local/lib/python3.7/copy.py in deepcopy(x, memo, _nil)
148 copier = _deepcopy_dispatch.get(cls)
149 if copier:
--> 150 y = copier(x, memo)
151 else:
152 try:
/home/sage/sage/local/lib/python3.7/copy.py in _deepcopy_dict(x, memo, deepcopy)
238 memo[id(x)] = y
239 for key, value in x.items():
--> 240 y[deepcopy(key, memo)] = deepcopy(value, memo)
241 return y
242 d[dict] = _deepcopy_dict
... last 5 frames repeated, from the frame below ...
/home/sage/sage/local/lib/python3.7/copy.py in deepcopy(x, memo, _nil)
178 y = x
179 else:
--> 180 y = _reconstruct(x, memo, *rv)
181
182 # If is its own copy, don't memoize.
RecursionError: maximum recursion depth exceeded in comparison
and doing the following causes a segfault and crashes Sage
sage: sys.setrecursionlimit(2**30)
sage: deepcopy(m)
{{{
}}}
I don't think the
deepcopy
protocol is implemented for Sage objects. Most Sage objects are immutable.