[Python-3000] PEP 3137 plan of attack

Christian Heimes lists at cheimes.de
Tue Oct 9 01:29:31 CEST 2007


Brett Cannon wrote:
> See http://bugs.python.org/issue1247 for Christian's patch.  Maybe you
> can do a code review of Christian's work, Alexandre?  And if you want
> to be really brave you could maybe even do the commit yourself.  =)

I'm not happy with:

    static const char *quote_prefix = "buffer(b'";
    p = PyUnicode_AS_UNICODE(v);
    for (i=0; i<strlen(quote_prefix); i++) {
        *p++ = quote_prefix[i];
    }

but I didn't know how to code it more elegant. It follows the previous
version of the code and it's the fastest way I can think of without
messing around with unicode. strncpy/memcpy doesn't work for obvious
reasons. :/

Christian


More information about the Python-3000 mailing list