You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This warning was added in python 3.2 and is triggered by allowing the reference count of an opened file to go to zero -- in this case stream in IndexFile._store_path.
Is it safe to call stream.close() after the istream object is created?
The text was updated successfully, but these errors were encountered:
Sorry for the late reply.
The IndexFile implementation doesn't take ownership if the passed-in streams, and therefore just expects them to be readable until EOF.
There is not a single close call on streams in the implementation.
To answer your question: Yes, it should be safe to close your own streams, and it's even recommended to prevent leakage.
However, your question raises my fear that in python 3, resource handling won't work anymore. Usually you could assume that file handles/streams are closed when they are dropped, but as __del__() now only gets called sometime, calls to add() could cause exceeding the maximum amount of concurrently open files of the python process.
Every time I add a file to the index I get the following warning:
This warning was added in python 3.2 and is triggered by allowing the reference count of an opened file to go to zero -- in this case
stream
inIndexFile._store_path
.Is it safe to call
stream.close()
after theistream
object is created?The text was updated successfully, but these errors were encountered: