On 2/26/19 3:54 PM, Marko Rauhamaa wrote: > Consider this function: > > def fun(): > f = open("lock") > flock.flock(f, fcntl.LOCK_EX) > do_stuff() > sys.exit(0) > > Question: can a compliant Python implementation close f (and, > consequently, release the file lock) before/while do_stuff() is > executed? > > I couldn't find an immediate answer in the documentation.
Not quite sure what you are asking. Are you asking if the file handle can be closed before (or concurrently if do_stuff() is a thread) and do_stuff() can continue to make use of the handle? -- https://mail.python.org/mailman/listinfo/python-list