[Python-Dev] Big trouble in CVS Python

Tim Peters tim.one@comcast.net
Mon, 14 Apr 2003 16:20:58 -0400

[Chad Netzer]
> Hmm, then this is my fault.  I did exactly that.

Guido thinks he broke it when he updated the patch.  It doesn't really
matter to me -- I hate everyone anyway <wink>.

> My approach was to Py_INCREF an optional argument it if it was given (ie.
> not NULL), otherwise to create it from scratch, and Py_DECREF when I was
> done.  I believe this was a not uncommon idiom (I can't recal the
> specifics, but being my first submitted patch, I made sure to try to look
> for existing idioms for argument and error handling).  I apologize if I
> erred.

I don't know -- and it doesn't matter.  I ended up (perhaps) restoring your
original intent.  I think Guido was provoked into fiddling it to begin with
because of the large number of exit labels in the original.

>   I assume a better approach, then is to get the optional istep
> argument, and copy it into a variable for your own use (or create it if
> it didn't exist)?  ie. Never increment or decrement the optional
> argument object, returned from PyArg_ParseTuple, at all?

That's usually safest.  This was an unusual function, though (range's
signature is messy, and the extension to long required defaults that
couldn't be expressed as native C types).

> ...
> I'll submit a patch to fix this all up tonight, if it hasn't already
> been addressed by then.

It's all been checked in.  Nothing left to do.

>> only-consumed-eight-hours-this-time<wink>-ly y'rs  - tim

> Oh, ow!  Now that pains me.  I am very sorry to hear this wasted so much
> time.

Well, what do you think weekends are for <wink>?