#10963: More functorial constructions
-------------------------------------+-------------------------------------
Reporter: nthiery | Owner: stumpc5
Type: enhancement | Status: needs_work
Priority: major | Milestone:
Component: categories | Resolution:
Keywords: | Merged in:
Authors: Nicolas M. ThiƩry | Reviewers: Simon King
Report Upstream: N/A | Work issues: Reduce startup time
Branch: | by 5%. Avoid "recursion depth
Dependencies: #11224, #8327, | exceeded (ignored)".
#10193, #12895, #14516, #14722, | Commit:
#13589, #14471 | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by SimonKing):
Two more data points.
When I provide the class A with a `__del__` method printing a debug
message, I see that first the (now non-nested) calls to the eraser happen,
and then FOUR `Exception RuntimeError: ... ignored` are reported, namely:
{{{
Exception RuntimeError: 'maximum recursion depth exceeded while calling a
Python object' in <sage.structure.coerce_dict.MonoDictEraser object at
0x5610440> ignored
Exception RuntimeError: 'maximum recursion depth exceeded while calling a
Python object' in <bound method A.__del__ of <__main__.A instance at
0x573b3f8>> ignored
Exception RuntimeError: 'maximum recursion depth exceeded while calling a
Python object' in <bound method A.__del__ of <__main__.A instance at
0x573b368>> ignored
Exception RuntimeError: 'maximum recursion depth exceeded' in <bound
method A.__del__ of <__main__.A instance at 0x573b2d8>> ignored
}}}
and only in the very end, all calls to `__del__` happen. I.e., the calls
to `__del__` are not mixed with calls to the eraser.
However, when I define `A` as a cdef class with `__weakref__` and a
`__dealloc__` method (again printing debug info), the picture is
different: The `__dealloc__` of K1 is called, then the eraser for K1 is
called (deleting the key-value pair K1,K2 from the `MonoDict`), then the
eraser for K1 returns, then `__dealloc__` for K2 is called, followed by
the eraser for K2, and so on. So, `__del__` is not mixed with calling the
erasers, but `__dealloc__` is mixed. And in the very and, there are two
errors reported:
{{{
Exception RuntimeError: 'maximum recursion depth exceeded while calling a
Python object' in
<_home_simon__sage_temp_linux_sqwp_site_5429_tmp_oooXg4_spyx_0.A object at
0x570e738> ignored
Exception RuntimeError: 'maximum recursion depth exceeded while calling a
Python object' in <sage.structure.coerce_dict.MonoDictEraser object at
0x560f440> ignored
}}}
Frankly I'm puzzled.
--
Ticket URL: <http://trac.sagemath.org/ticket/10963#comment:101>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.