diff options
author | Xiaofei Wang <6218006+wangxf123456@users.noreply.github.com> | 2019-07-17 11:16:53 -0700 |
---|---|---|
committer | Tres Seaver <tseaver@palladion.com> | 2019-07-17 14:16:53 -0400 |
commit | 20b67588e9a009a30ed883337dc70a43729ba486 (patch) | |
tree | e918fa5fda983250c8bc0ca8b5f56d62e01fae46 /googleapiclient | |
parent | b854ff13c801b98f97ff3b9a2ddbd9af54724b9a (diff) | |
download | google-api-python-client-20b67588e9a009a30ed883337dc70a43729ba486.tar.gz |
Make http.MediaFileUpload close its file descriptor. (#600)
Closes #575.
Diffstat (limited to 'googleapiclient')
-rw-r--r-- | googleapiclient/http.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/googleapiclient/http.py b/googleapiclient/http.py index 5caca19c4..e795274f5 100644 --- a/googleapiclient/http.py +++ b/googleapiclient/http.py @@ -558,9 +558,13 @@ class MediaFileUpload(MediaIoBaseUpload): if mimetype is None: # Guess failed, use octet-stream. mimetype = 'application/octet-stream' - super(MediaFileUpload, self).__init__(fd, mimetype, chunksize=chunksize, + super(MediaFileUpload, self).__init__(fd, mimetype, + chunksize=chunksize, resumable=resumable) + def __del__(self): + self._fd.close() + def to_json(self): """Creating a JSON representation of an instance of MediaFileUpload. |