1. Pypy
  2. Untitled project
  3. pypy

Commits

Alex Gaynor  committed 89041e7

set a good example for the children.

  • Participants
  • Parent commits b93fffd
  • Branches default

Comments (0)

Files changed (1)

File pypy/tool/gdb_pypy.py

View file
  • Ignore whitespace
 (gdb) python execfile('/path/to/gdb_pypy.py')
 """
 
+from __future__ import with_statement
+
 import sys
 import os.path
 
         typeids_txt = os.path.join(root, 'typeids.txt')
         print 'loading', typeids_txt
         typeids = {}
-        for line in open(typeids_txt):
-            member, descr = map(str.strip, line.split(None, 1))
-            expr = "((char*)(&pypy_g_typeinfo.%s)) - (char*)&pypy_g_typeinfo" % member
-            offset = int(self.gdb.parse_and_eval(expr))
-            typeids[offset] = descr
+        with open(typeids_txt) as f:
+            for line in f:
+                member, descr = map(str.strip, line.split(None, 1))
+                expr = "((char*)(&pypy_g_typeinfo.%s)) - (char*)&pypy_g_typeinfo" % member
+                offset = int(self.gdb.parse_and_eval(expr))
+                typeids[offset] = descr
         return typeids
 
 try: