Open donsokolone opened 2 months ago
hi @donsokolone :wave:
how about setting self._buf = None
in terminate
? then close
is a no-op by the time the SinglepartWriter is garbage collected, analogous to MultipartWriter.
cc @mpenkov
@ddelange This is exactly what the fix should be, as I mentioned in #763. I will PR it in few moments.
Problem description
When there is an unhandled exception raised in context of SinglepartWriter side-effect occurs when writer is garbage-collected which results in unwanted write of partial file into S3.
Reason for this behaviour is
SinglepartWriter
inheritsio.BufferedIOBase
which invokesclose()
in__del__()
descriptior.Steps/code to reproduce the problem
smart_open
logger level to DEBUGsmart_open.s3.SinglepartWriter
log records indicating S3 write was performedVersions