[MERGE] BEncode Pyrex, pt 4

Andrew Bennetts andrew.bennetts at canonical.com
Wed May 27 21:47:02 BST 2009

Jelmer Vernooij wrote:
> Hi John,
> This patch fixes;
>  * Use PyInt_FromString rather than PyLong_FromString
>  * Avoid the use of strndup in the inner loop, instead using a static
> buffer that we copy into

This is not a complete review, but I'd also like to see tests for what
happens when encoding and decoding an extremely deeply nested structure.

    l = []
    for i in range(1000):
        l = [l]


    s = 'l' * 1000 + 'e' * 1000

I don't mind if they raise RuntimeError rather than successfully
encoding/decoding (I expect the current Python implementation does this),
but it would be a problem if either caused a segfault.

Be evil (when designing tests).  :)


More information about the bazaar mailing list