aboutsummaryrefslogtreecommitdiff
path: root/googleapiclient
diff options
context:
space:
mode:
authorXiaofei Wang <6218006+wangxf123456@users.noreply.github.com>2019-07-17 11:16:53 -0700
committerTres Seaver <tseaver@palladion.com>2019-07-17 14:16:53 -0400
commit20b67588e9a009a30ed883337dc70a43729ba486 (patch)
treee918fa5fda983250c8bc0ca8b5f56d62e01fae46 /googleapiclient
parentb854ff13c801b98f97ff3b9a2ddbd9af54724b9a (diff)
downloadgoogle-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.py6
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.