[Cython] Crash with freelist() and __slots__

Robert Bradshaw robertwb at gmail.com
Wed Mar 5 09:09:46 CET 2014


On Mon, Mar 3, 2014 at 8:38 AM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Hi,
>
> I was made aware of crashes in the last lxml release, which turned out to
> be due to the use of freelists for types that could be subtyped from Python
> code. I was able to work around them in lxml, however, the real problem is
> in Cython. There was supposed to be a safe guard for that case in the
> freelist code based on the object struct size, which increases for subtypes
> that have a __dict__. However, if the Python subtype uses an empty
> __slots__ declaration, the object struct size will not increase, thus
> passing the guard.
>
> The correct fix is to also test if the type being instantiated lives on the
> heap and exclude it from the freelist if so.
>
> https://github.com/cython/cython/commit/d2aff824dd0900982a420ebaaa1dac6120a9d72e
>
> This, together with the buffer/memory view related bugs I fixed since the
> last release, suggest (at least to me) that we shouldn't wait all too long
> with the next bug fix release.

Sounds good to me. Did you want to get the process rolling, or should I?

> From my POV, all changes in current master are safe enough to go out.
>
> Stefan
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> https://mail.python.org/mailman/listinfo/cython-devel


More information about the cython-devel mailing list