christian.heimes wrote:

> Author: christian.heimes
> Date: Mon Nov  5 00:19:08 2007
> New Revision: 58848
> 
> Modified:
>    python/branches/py3k-pep3137/Lib/test/test_codecs.py
>    python/branches/py3k-pep3137/Lib/test/test_multibytecodec_support.py
>    python/branches/py3k-pep3137/Modules/_codecsmodule.c
>    python/branches/py3k-pep3137/Modules/cjkcodecs/multibytecodec.c
> Log:
> Patch #1386 from Amaury Forgeot d'Arc
> 
> Most codecs return buffer objects, when the rule is now to return bytes.
> This patch adds a test, and corrects failing codecs.
> (more PyBytes_* -> PyString_* replacements)
> 
> The patch doesn't fix any outstanding bugs but it removes the rest of the 
> annoying codec warnings. I've modified the patch slightly (assert() -> 
> self.assert_()). Thanks Amaury! :)
> 
> [...]
>               *p = '\0';
> -             if (PyBytes_Resize(v, (p - PyBytes_AS_STRING(v)))) {
> +             if (_PyString_Resize(&v, (p - PyString_AS_STRING(v)))) {
>                       Py_DECREF(v);
>                       return NULL;
>               }
>       }

When an error occurs _PyString_Resize() sets v to NULL, so this will 
lead to a segfault. The DECREF should be removed.

Servus,
    Walter
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to