Steve Holden wrote:
>> in theory, if PyInt_FromLong succeeds, and PyTuple_SetItem fails, you'll leak
>> an object.
>
> And in practice this will only happen during a period when you are relying
> critically on it *not*
> to ...
yeah, but if PyTuple_SetItem fails in this case, you better move th
On Thu, 03 Feb 2005 07:45:22 -0500, Steve Holden wrote:
> Fredrik Lundh wrote:
>> in theory, if PyInt_FromLong succeeds, and PyTuple_SetItem fails, you'll leak
>> an object.
>>
>>
>>
> And in practice this will only happen during a period when you are
> relying critically on it *not* to ...
Fredrik Lundh wrote:
Dave Cole wrote:
for (i = 0; i < num_values; i++) {
PyObject *obj;
obj = PyInt_FromLong(value[i]);
if (obj == NULL
|| PyTuple_SetItem(tuple, i, obj) != 0) {
Py_DECREF(tuple);
return NULL;
}
}
in theory, if PyInt_FromLong succeeds, and PyTuple_SetItem fa
Dave Cole wrote:
> for (i = 0; i < num_values; i++) {
> PyObject *obj;
>
> obj = PyInt_FromLong(value[i]);
> if (obj == NULL
> || PyTuple_SetItem(tuple, i, obj) != 0) {
> Py_DECREF(tuple);
> return NULL;
> }
> }
in theory, if PyInt_FromLong succeeds, and PyTuple_SetIte
John Machin wrote:
Dave Opstad wrote:
One of the functions in a C extension I'm writing needs to return a
tuple of integers, where the length of the tuple is only known at
runtime. I'm currently doing a loop calling PyInt_FromLong to make
the
integers,
What is the purpose of this first loop?
In wh
Dave Opstad wrote:
> This would certainly be simpler, although I'm not sure I'm as clear as
> to what happens if, say, in the middle of this loop a PyInt_FromLong
> fails. I know that PyTuple_SetItem steals the reference; does that mean
> I could just Py_DECREF the tuple and all the pieces will be
Dave Opstad wrote:
> In article <[EMAIL PROTECTED]>,
> "John Machin" <[EMAIL PROTECTED]> wrote:
>
> > What is the purpose of this first loop?
>
> Error handling. If I can't successfully create all the PyInts then I
can
> dispose the ones I've made and not bother making the tuple at all.
> >
> > I
In article <[EMAIL PROTECTED]>,
"John Machin" <[EMAIL PROTECTED]> wrote:
> What is the purpose of this first loop?
Error handling. If I can't successfully create all the PyInts then I can
dispose the ones I've made and not bother making the tuple at all.
>
> In what variable-length storage are
Dave Opstad wrote:
> One of the functions in a C extension I'm writing needs to return a
> tuple of integers, where the length of the tuple is only known at
> runtime. I'm currently doing a loop calling PyInt_FromLong to make
the
> integers,
What is the purpose of this first loop?
In what variabl
> One of the functions in a C extension I'm writing needs to return a
> tuple of integers, where the length of the tuple is only known at
> runtime. I'm currently doing a loop calling PyInt_FromLong to make the
> integers, then PyTuple_New, and finally a loop calling PyTuple_SET_ITEM
> to set the t
10 matches
Mail list logo