[Python-Dev] Big trouble in CVS Python

Guido van Rossum guido@python.org
Sun, 13 Apr 2003 21:01:46 -0400


> It appears to be a refcount error in recently-added C code that tries to
> generalize the builtin range() function, specifically here:
> 
>   Fail:
> 	Py_XDECREF(curnum);
> 	Py_XDECREF(istep);  <- here
> 	Py_XDECREF(zero);
> 
> Word to the wise:  don't ever try to reuse a variable whose address is
> passed to PyArg_ParseTuple for anything other than holding what
> PyArg_ParseTuple does or doesn't store into it.  You'll never get the
> decrefs straight (and even if you manage to at first, the next person to
> modify your code will break it).

It's possible that I introduced that bug when I reworked the patch to
use a single label rather than one for each variable. :-(

--Guido van Rossum (home page: http://www.python.org/~guido/)