#17056: Bugs in WordDatatype_char
-------------------------------------+-------------------------------------
Reporter: vdelecroix | Owner:
Type: defect | Status: needs_review
Priority: critical | Milestone: sage-6.4
Component: combinatorics | Resolution:
Keywords: | Merged in:
Authors: Vincent Delecroix | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/vdelecroix/17056 | 5b5d4859c20be447ce3aa72d53fd680fec3ea0ab
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Old description:
> There are two bugs with WordDatatype_char (new datastructure for words
> introduced in #17013):
> - in `__dealloc__` we access a Python attribute... it is very bad since
> Cython is such that they are deallocated before the call to
> `__dealloc__`. In different situations sage terminates because of a
> memory corruption
> - in `__getitem__` we had
> {{{
> sage: W = Words([0,1,2])
> sage: w = W([0,1,0])
> sage: w[:0]
> word: ... <RANDOM STUFF> ...
> }}}
New description:
There are two bugs with WordDatatype_char (new datastructure for words
introduced in #17013):
- in `__dealloc__` we access a Python attribute... it is very bad since
Cython is such that they are deallocated before the call to `__dealloc__`.
In different situations sage terminates because of a memory corruption
- in `__getitem__` we had
{{{
sage: W = Words([0,1,2])
sage: w = W([0,1,0])
sage: w[1:0]
word: ... <RANDOM STUFF> ...
}}}
--
Comment (by vdelecroix):
Hello,
Sorry, I was wrong it is `w[1:0]` which is bad.
For the problem with `__dealloc__`, you must be lucky to see it (as it
depends on the choice of Python for the deallocation of objects). Try
{{{
sage: W = Words([0,1,2])
sage: w = W([randint(0,2) for _ in range(100)])
sage: u = w[10:-10]
sage: c = [u.number_of_factors(n) for n in range(20)]
sage: quit
<BOOM>
}}}
Vincent
--
Ticket URL: <http://trac.sagemath.org/ticket/17056#comment:6>
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/d/optout.