#10113: Calling seed() incorrectly causes Sage to crash with SIGSEGV
(Segmentation
Fault)
----------------------------+-----------------------------------------------
Reporter: drkirkby | Owner: jason
Type: defect | Status: new
Priority: major | Milestone: sage-5.0
Component: misc | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
----------------------------+-----------------------------------------------
Comment (by SimonKing):
Yes, I got it!
The problem is as follows:
* `randstate.__init__` takes exactly one argument `seed` (beside `self`).
* You give it two arguments. Thus, `__init__` fails before being
executed.
* After that, `__dealloc__` is called, but the c-data are not
initialised, because `__init__` has not beeen executed.
I think the following is a clean solution:
* Add a `__cinit__` method that accepts ''any'' arguments (so that no
error is raised before it is executed).
* Initialise c-data in `__cinit__`
* If calling `__init__` fails, then `__cinit__` has already been
executed. Hence, `__dealloc__` works, and thus one just sees the due
error, but no segfault.
Preparing a patch now!
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10113#comment:5>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.