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
The issue it fixes is perfectly legitimate but the way it fixes it introduces this bug.
S3File implements some kind of lazy opening by leveraging the file property (and its _get_file accessor). The file is not actually opened until the file property is first accessed, self._file remains None until then.
With the current closed implementation, self._file being None results in closed returning False even though in this case the file was never closed, it was never even read from.
Proposed fixes
I see two approaches:
keeping track of whether a S3File is opened of closed through a _closed attribute (for example), setting it to True in S3File.__init__, to False in S3File.close and reading it in S3File.closed
forcing _file to be defined by calling f.file in S3Storage._open
I have no idea which is better (might be another approach altogether).
Hey there!
Description
After updating to 1.14 I encountered the following issue:
Analysis
I pinpointed the issue to commit af91e2c.
The issue it fixes is perfectly legitimate but the way it fixes it introduces this bug.
S3File
implements some kind of lazy opening by leveraging thefile
property (and its_get_file
accessor). The file is not actually opened until thefile
property is first accessed,self._file
remainsNone
until then.With the current
closed
implementation,self._file
beingNone
results inclosed
returningFalse
even though in this case the file was never closed, it was never even read from.Proposed fixes
I see two approaches:
S3File
is opened of closed through a_closed
attribute (for example), setting it toTrue
inS3File.__init__
, toFalse
inS3File.close
and reading it inS3File.closed
_file
to be defined by callingf.file
inS3Storage._open
I have no idea which is better (might be another approach altogether).
NB: might be related to #1308
The text was updated successfully, but these errors were encountered: