[issue10538] PyArg_ParseTuple(s*) does not always incref object

2012-03-22 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

Adding a patch here.

--
keywords: +patch
Added file: http://bugs.python.org/file24995/#10538.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10538
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10538] PyArg_ParseTuple(s*) does not always incref object

2012-03-22 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Looks good to me.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10538
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10538] PyArg_ParseTuple(s*) does not always incref object

2012-03-22 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 17c671529f7e by Kristján Valur Jónsson in branch '2.7':
Issue #10538. Put a reference to the source object in the Py_buffer when
http://hg.python.org/cpython/rev/17c671529f7e

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10538
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10538] PyArg_ParseTuple(s*) does not always incref object

2012-03-22 Thread Kristján Valur Jónsson

Changes by Kristján Valur Jónsson krist...@ccpgames.com:


--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10538
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10538] PyArg_ParseTuple(s*) does not always incref object

2012-03-22 Thread STINNER Victor

STINNER Victor victor.stin...@gmail.com added the comment:

You should mention your change in Misc/NEWS.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10538
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10538] PyArg_ParseTuple(s*) does not always incref object

2012-03-22 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 8efe88c0f14e by krisvale in branch '2.7':
Issue #10538 - Update Misc/NEWS
http://hg.python.org/cpython/rev/8efe88c0f14e

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10538
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10538] PyArg_ParseTuple(s*) does not always incref object

2012-03-22 Thread STINNER Victor

STINNER Victor victor.stin...@gmail.com added the comment:

Thanks :-)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10538
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10538] PyArg_ParseTuple(s*) does not always incref object

2012-03-20 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy: +skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10538
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10538] PyArg_ParseTuple(s*) does not always incref object

2010-12-15 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
assignee: pitrou - 

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10538
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10538] PyArg_ParseTuple(s*) does not always incref object

2010-12-15 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

Well, I can submit a patch if anyone is interested.
I came across this when writing asynchronous network code.  By hanging onto the 
Py_buffer, I should have access to the data during the network call.  But it 
only worked for true Py_buffer objects and not the others.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10538
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10538] PyArg_ParseTuple(s*) does not always incref object

2010-11-26 Thread Kristján Valur Jónsson

New submission from Kristján Valur Jónsson krist...@ccpgames.com:

The new s* code for PyArg_ParseTuple is used to fill a Py_buffer object from 
the arguments.  This object must be relased using PyBuffer_Release() after use.

However, if the object in the tuple does not support the new buffer interface, 
the old buffer interface is queried and the Py_buffer object is manually filled 
in.  For this case, the source object is _not_ increfed and buffer.obj remains 
set to 0.

This causes different semantics in the function for objects that are passed in: 
 If the Py_buffer interface is supported directly, then it is safe for the 
function to store this and release this at a later time.  If it isn't 
supported, then no extra reference to the object is got and the function cannot 
safely keep the Py_buffer object around.

The Fix is as follows:  Change line 1402 of getargs.c from:
PyBuffer_FillInfo(view, NULL, buf, count, 1, 0);
to
PyBuffer_FillInfo(view, arg, buf, count, 1, 0);

--
messages: 122445
nosy: krisvale
priority: normal
severity: normal
status: open
title: PyArg_ParseTuple(s*) does not always incref object
type: behavior
versions: Python 2.7, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10538
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10538] PyArg_ParseTuple(s*) does not always incref object

2010-11-26 Thread Kristján Valur Jónsson

Changes by Kristján Valur Jónsson krist...@ccpgames.com:


--
versions:  -Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10538
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10538] PyArg_ParseTuple(s*) does not always incref object

2010-11-26 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
assignee:  - pitrou
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10538
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10538] PyArg_ParseTuple(s*) does not always incref object

2010-11-26 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10538
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com