[pypy-commit] pypy win32-fixes5: on windows NamedTemporaryFile cannot be reopened by gdb.execute while open in caller
mattip
noreply at buildbot.pypy.org
Sat Sep 27 23:14:37 CEST 2014
Author: mattip <matti.picus at gmail.com>
Branch: win32-fixes5
Changeset: r73727:5ca6de0f2fa5
Date: 2014-09-27 23:04 +0300
http://bitbucket.org/pypy/pypy/changeset/5ca6de0f2fa5/
Log: on windows NamedTemporaryFile cannot be reopened by gdb.execute
while open in caller
diff --git a/pypy/tool/gdb_pypy.py b/pypy/tool/gdb_pypy.py
--- a/pypy/tool/gdb_pypy.py
+++ b/pypy/tool/gdb_pypy.py
@@ -123,11 +123,15 @@
vname = 'pypy_g_rpython_memory_gctypelayout_GCData.gcd_inst_typeids_z'
length = int(self.gdb.parse_and_eval('*(long*)%s' % vname))
vstart = '(char*)(((long*)%s)+1)' % vname
- with tempfile.NamedTemporaryFile('rb') as fobj:
+ fname = tempfile.mktemp()
+ try:
self.gdb.execute('dump binary memory %s %s %s+%d' %
- (fobj.name, vstart, vstart, length))
- data = fobj.read()
- return TypeIdsMap(zlib.decompress(data).splitlines(True), self.gdb)
+ (fname, vstart, vstart, length))
+ with open(fname, 'rt') as fobj:
+ data = fobj.read()
+ return TypeIdsMap(zlib.decompress(data).splitlines(True), self.gdb)
+ finally:
+ os.remove(fname)
class TypeIdsMap(object):
More information about the pypy-commit
mailing list