fjricci added a comment.

Because python 3 doesn't use `FILE*` as the underlying implementation anymore, 
I think the only way to make this work is to continue to use `dup()` to make 
the `FILE*`, but then to actually keep track of the ownership of the `FILE*`. 
This can't be done inside `PythonFile`, because the `PythonFile` will go out of 
scope before `SetImmediateOutputFile` is called. This leaves me thinking that 
best possibility would be to expose the `transfer_ownership` flag to the python 
API and then change the call to set this flag. However, this flag isn't 
currently exposed above the implementation level, and I'm not sure that it 
makes sense for it to be from an API point of view.

As an alternative fix, I can also change `PythonFile` to use `PyFile_AsFile()` 
on Python < 3, and the currently existing implementation on Python >= 3. 
However, this won't actually fix the `FILE*` leak on python 3.


http://reviews.llvm.org/D18459



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to