Opened 22 months ago
Last modified 3 months ago
#30499 new defect
deepcopy() fails for lift_map from residue field of a number field
Reported by: | gh-walnutmonster | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-9.7 |
Component: | number theory | Keywords: | deepcopy, lift_map |
Cc: | pbruin, gh-mjungmath | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
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) {{{ }}}
Change History (9)
comment:1 Changed 22 months ago by
comment:2 Changed 22 months ago by
- Cc gh-mjungmath added
comment:3 Changed 20 months ago by
- Milestone changed from sage-9.2 to sage-9.3
comment:4 Changed 15 months ago by
- Milestone changed from sage-9.3 to sage-9.4
Moving this ticket to 9.4, as it seems unlikely that it will be merged in 9.3, which is in the release candidate stage
comment:5 Changed 11 months ago by
- Milestone changed from sage-9.4 to sage-9.5
comment:6 follow-up: ↓ 7 Changed 10 months ago by
- Dependencies set to #32478
This will be fixed in #32478
comment:7 in reply to: ↑ 6 Changed 10 months ago by
- Dependencies #32478 deleted
comment:8 Changed 7 months ago by
- Milestone changed from sage-9.5 to sage-9.6
comment:9 Changed 3 months ago by
- Milestone changed from sage-9.6 to sage-9.7
Note: See
TracTickets for help on using
tickets.
I don't think the
deepcopy
protocol is implemented for Sage objects. Most Sage objects are immutable.