Github user BryanCutler commented on a diff in the pull request:
https://github.com/apache/spark/pull/20373#discussion_r163421285
--- Diff: python/pyspark/cloudpickle.py ---
@@ -913,11 +841,12 @@ def dump(obj, file, protocol=2):
def dumps(obj, protocol=2):
file = StringIO()
-
- cp = CloudPickler(file,protocol)
- cp.dump(obj)
-
- return file.getvalue()
+ try:
+ cp = CloudPickler(file,protocol)
+ cp.dump(obj)
+ return file.getvalue()
+ finally:
+ file.close()
--- End diff --
Close StringIO timely on exception
https://github.com/cloudpipe/cloudpickle/commit/ca4661b3a20b635f4c240ef763f5759267d74cb9
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]