[Python-Dev] Big trouble in CVS Python (original) (raw)

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: PyXDECREF(curnum); PyXDECREF(istep); <- here PyXDECREF(zero); Word to the wise: don't ever try to reuse a variable whose address is passed to PyArgParseTuple for anything other than holding what PyArgParseTuple 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/)