[Python-checkins] cpython (3.3): Close file before reopening to keep Windows happy in test_sax.
richard.oudkerk
python-checkins at python.org
Sat May 18 19:14:16 CEST 2013
http://hg.python.org/cpython/rev/e5d2af7a35c0
changeset: 83830:e5d2af7a35c0
branch: 3.3
parent: 83827:c627638753e2
user: Richard Oudkerk <shibturn at gmail.com>
date: Sat May 18 18:11:30 2013 +0100
summary:
Close file before reopening to keep Windows happy in test_sax.
files:
Lib/test/test_sax.py | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py
--- a/Lib/test/test_sax.py
+++ b/Lib/test/test_sax.py
@@ -578,13 +578,14 @@
writer.close()
support.unlink(self.fname)
self.addCleanup(cleanup)
- writer.getvalue = self.getvalue
+ def getvalue():
+ # Windows will not let use reopen without first closing
+ writer.close()
+ with open(writer.name, 'rb') as f:
+ return f.read()
+ writer.getvalue = getvalue
return writer
- def getvalue(self):
- with open(self.fname, 'rb') as f:
- return f.read()
-
def xml(self, doc, encoding='iso-8859-1'):
return ('<?xml version="1.0" encoding="%s"?>\n%s' %
(encoding, doc)).encode('ascii', 'xmlcharrefreplace')
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list