On 09/05/11 09:05, Markus Schaber wrote:
> Hi, Hick,
> 
>> Von: Piper, Nick [mailto:nick.pi...@logica.com]
>  
>> In Python, f is a "file" instance, but that will be converted to a
>> svn_stream_t by swig (by svn_swig_py_make_stream()).
>>
>> That file then goes out of scope in Python, but the file descriptor is
>> never closed. I don't see where we should be calling
> svn_stream_close() in
>> order to do that (and call Py_DECREF(py_io)), because the svn_stream_t
> is
>> never exposed back to Python.
> 
> I'm not sure about what svn_swig_py_make_stream() does, but normal
> python files automatically close the underlying os resources (file
> descriptor etc.) when they are garbage collected.

I feel in this case, the reference counting means that the gc won't
happen - Py_INCREF(py_io) at
https://github.com/apache/subversion/blob/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c#L2126
increases it by one, but the corresponding Py_DECREF(py_io) at
https://github.com/apache/subversion/blob/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c#L2112
is never called.

I'll continue to study this to see if I'm correct or not....

 Nick

-- 
Sorry for this disclaimer:

Think green - keep it on the screen.
This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you. 


Reply via email to