diff options
Diffstat (limited to 'tests/run/cpdef_pickle.srctree')
-rw-r--r-- | tests/run/cpdef_pickle.srctree | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/run/cpdef_pickle.srctree b/tests/run/cpdef_pickle.srctree index cd531a491..da126b8d0 100644 --- a/tests/run/cpdef_pickle.srctree +++ b/tests/run/cpdef_pickle.srctree @@ -56,7 +56,8 @@ from lib.cy import WithoutC, WithCPDef, WithCDefWrapper def tryThis(obj): print("Pickling %s ..." % obj.__class__.__name__) try: - pkl.dump(obj, open("test.pkl", "wb")) + with open("test.pkl", "wb") as fid: + pkl.dump(obj, fid) print("\t... OK") except Exception as e: print("\t... KO: %s" % str(e)) |