Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
lldb/scripts/interface/SBFile.i
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | public: | ||||
void Flush(); | void Flush(); | ||||
bool IsValid() const; | bool IsValid() const; | ||||
operator bool() const; | operator bool() const; | ||||
SBError Close(); | SBError Close(); | ||||
%feature("docstring", " | |||||
labath: I am somewhat surprised that there's no ownership handling in this patch (whereas ownership… | |||||
Oh, yea good point. GetFile returns a borrowed file, it shouldn't be closed. I'll add a comment explaining. lawrence_danna: Oh, yea good point. `GetFile` returns a borrowed file, it shouldn't be closed. I'll add a… | |||||
Cool, thanks. This description is very helpful. labath: Cool, thanks. This description is very helpful. | |||||
Convert this SBFile into a python io.IOBase file object. | |||||
If the SBFile is itself a wrapper around a python file object, | |||||
this will return that original object. | |||||
The file returned from here should be considered borrowed, | |||||
in the sense that you may read and write to it, and flush it, | |||||
etc, but you should not close it. If you want to close the | |||||
SBFile, call SBFile.Close(). | |||||
If there is no underlying python file to unwrap, GetFile will | |||||
use the file descriptor, if availble to create a new python | |||||
s/descirptor/descriptor labath: s/descirptor/descriptor | |||||
file object using `open(fd, mode=..., closefd=False)` | |||||
"); | |||||
FileSP GetFile(); | |||||
}; | }; | ||||
} // namespace lldb | } // namespace lldb |
I am somewhat surprised that there's no ownership handling in this patch (whereas ownership transfer was a fairly big chunk of the conversion in the other direction). Could you maybe explain what are the ownership expectations of the file returned through here (and what happens when we close it for instance)?