[issue13013] _ctypes.c: refleak

2011-09-27 Thread Roundup Robot

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

New changeset 1fb5b0cc6367 by Meador Inge in branch '2.7':
Issue #13013: ctypes: Fix a reference leak in PyCArrayType_from_ctype.
http://hg.python.org/cpython/rev/1fb5b0cc6367

New changeset 58a75eeb5c8e by Meador Inge in branch '3.2':
Issue #13013: ctypes: Fix a reference leak in PyCArrayType_from_ctype.
http://hg.python.org/cpython/rev/58a75eeb5c8e

New changeset 1726fa560112 by Meador Inge in branch 'default':
Issue #13013: ctypes: Fix a reference leak in PyCArrayType_from_ctype.
http://hg.python.org/cpython/rev/1726fa560112

--
nosy: +python-dev

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



[issue13013] _ctypes.c: refleak

2011-09-27 Thread Meador Inge

Changes by Meador Inge mead...@gmail.com:


--
resolution:  - fixed
stage: test needed - committed/rejected
status: open - closed

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



[issue13013] _ctypes.c: refleak

2011-09-26 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

If the function is public I guess that some external module might use it, and 
possibly pass a wrong argument that triggers the leak.

--
nosy: +ezio.melotti

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



[issue13013] _ctypes.c: refleak

2011-09-26 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

 If the function is public I guess that some external module
 might use it

Agreed; That is the only case I could deduce as well, which I hinted at 
in msg144397.  So, I will leave the error check and keep the function
public for now.

I will commit the ref leak fix today.

--

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



[issue13013] _ctypes.c: refleak

2011-09-25 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

OK, I will just fix the ref leak in 2.7, 3.2, and 3.3.  This is a pretty 
low-risk fix (as I mentioned before, I can't see how the error condition is 
even executed).

--

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



[issue13013] _ctypes.c: refleak

2011-09-24 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

I vote for plugging the refleak and keeping the function non-static.

--
nosy: +georg.brandl

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



[issue13013] _ctypes.c: refleak

2011-09-23 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

My impression is that plugging refleaks (unlike minor speedups) is a bugfix 
rather than feature addition, so this and the other issues should be marked for 
2.7 and 3.2 also. (I am only changing this one.)

Deprecating a public (but obscure) CAPI function is a separate issue that would 
only affect 3.3 at the earliest (with a PendingDeprecation or Deprecation 
warning) and would be in addition to plugging the potential leak in the 
existing code.

--
nosy: +terry.reedy
versions: +Python 2.7, Python 3.2

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



[issue13013] _ctypes.c: refleak

2011-09-21 Thread Stefan Krah

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


--
title: Resource is not released before returning from the functiion - 
_ctypes.c: refleak

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



[issue13013] _ctypes.c: refleak

2011-09-21 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

This patch seems reasonable.  Upon looking at the code in more
detail, however, I can't see how the error condition that leaks the
reference can ever by triggered.  In particular, the following code
from the 'PyCArrayType_from_ctype' function:

if (!PyType_Check(itemtype)) {
PyErr_SetString(PyExc_TypeError,
Expected a type object);
return NULL;
}

'PyCArrayType_from_ctype' is only called from 'CDataType_repeat'.  The
'CDataType_repeat' function is only used to implement the 'sq_repeat' 
slot in 'CDataType_as_sequence'.  'CDataType_as_sequence' is used in all 
of the implemented ctypes (struct, array, union, simple, ...).

Unless 'PyCArrayType_from_ctype' is called through some other means
(it is public), then 'itemtype' should *always* be a type.  Or am 
I missing something obvious?  So, we could add the decref or just remove 
the type check code all together (and make 'PyCArrayType_from_ctype'
private).

--
nosy: +amaury.forgeotdarc, belopolsky

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