diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2011-03-16 11:35:38 +0200 |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2011-03-16 11:35:38 +0200 |
commit | a8fef3700df5400004ac88fa20c8bb4ff6f44ca3 (patch) | |
tree | 7745540e59b871e3d1b8b17757df99384cc91f68 /Lib/test/test_marshal.py | |
parent | e21d50c5c74e58bdf7173ab8d8966cfae2004728 (diff) | |
parent | 6a6e1e572574894dd211325eed26d099bde4778d (diff) | |
download | cpython-a8fef3700df5400004ac88fa20c8bb4ff6f44ca3.tar.gz |
#11565: Merge with 3.1.
Diffstat (limited to 'Lib/test/test_marshal.py')
-rw-r--r-- | Lib/test/test_marshal.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py index 5e1cdd5052..81cf598402 100644 --- a/Lib/test/test_marshal.py +++ b/Lib/test/test_marshal.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from test import support import marshal @@ -11,16 +11,10 @@ class HelperMixin: new = marshal.loads(marshal.dumps(sample, *extra)) self.assertEqual(sample, new) try: - f = open(support.TESTFN, "wb") - try: + with open(support.TESTFN, "wb") as f: marshal.dump(sample, f, *extra) - finally: - f.close() - f = open(support.TESTFN, "rb") - try: + with open(support.TESTFN, "rb") as f: new = marshal.load(f) - finally: - f.close() self.assertEqual(sample, new) finally: support.unlink(support.TESTFN) |