Author: Brian Kearns <[email protected]>
Branch: 
Changeset: r69687:d1a51abf3b33
Date: 2014-03-04 14:53 -0500
http://bitbucket.org/pypy/pypy/changeset/d1a51abf3b33/

Log:    replace a couple usages of streamio

diff --git a/pypy/module/_pypyjson/targetjson.py 
b/pypy/module/_pypyjson/targetjson.py
--- a/pypy/module/_pypyjson/targetjson.py
+++ b/pypy/module/_pypyjson/targetjson.py
@@ -4,12 +4,10 @@
 sys.path.insert(0, str(ROOT))
 
 import time
-from rpython.rlib.streamio import open_file_as_stream
 from pypy.interpreter.error import OperationError
 from pypy.module._pypyjson.interp_decoder import loads
 
 
-
 ## MSG = open('msg.json').read()
 
 class W_Root(object):
@@ -92,7 +90,7 @@
 
     def wrapfloat(self, x):
         return W_Float(x)
-    
+
     def wrap(self, x):
         if isinstance(x, int):
             return W_Int(x)
@@ -109,7 +107,6 @@
 
 def myloads(msg):
     return loads(fakespace, W_String(msg))
-    
 
 def bench(title, N, fn, arg):
     a = time.clock()
@@ -124,14 +121,14 @@
         return 1
     filename = argv[1]
     N = int(argv[2])
-    f = open_file_as_stream(filename)
-    msg = f.readall()
-    
+    f = open(filename)
+    msg = f.read()
+
     try:
         bench('loads     ', N, myloads,  msg)
     except OperationError, e:
         print 'Error', e._compute_value(fakespace)
-        
+
     return 0
 
 # _____ Define and setup target ___
diff --git a/pypy/module/gc/interp_gc.py b/pypy/module/gc/interp_gc.py
--- a/pypy/module/gc/interp_gc.py
+++ b/pypy/module/gc/interp_gc.py
@@ -1,7 +1,7 @@
 from pypy.interpreter.gateway import unwrap_spec
 from pypy.interpreter.error import OperationError
 from rpython.rlib import rgc
-from rpython.rlib.streamio import open_file_as_stream
+
 
 @unwrap_spec(generation=int)
 def collect(space, generation=0):
@@ -56,7 +56,7 @@
     if not tb:
         raise OperationError(space.w_RuntimeError,
                              space.wrap("Wrong GC"))
-    f = open_file_as_stream(filename, mode="w")
+    f = open(filename, mode="w")
     for i in range(len(tb)):
         f.write("%d %d " % (tb[i].count, tb[i].size))
         f.write(",".join([str(tb[i].links[j]) for j in range(len(tb))]) + "\n")
diff --git a/pypy/module/gc/test/test_gc.py b/pypy/module/gc/test/test_gc.py
--- a/pypy/module/gc/test/test_gc.py
+++ b/pypy/module/gc/test/test_gc.py
@@ -1,5 +1,6 @@
 import py
 
+
 class AppTestGC(object):
     def test_collect(self):
         import gc
@@ -69,6 +70,7 @@
         gc.enable()
         assert gc.isenabled()
 
+
 class AppTestGcDumpHeap(object):
     pytestmark = py.test.mark.xfail(run=False)
 
@@ -81,10 +83,10 @@
                 self.count = count
                 self.size = size
                 self.links = links
-        
+
         def fake_heap_stats():
             return [X(1, 12, [0, 0]), X(2, 10, [10, 0])]
-        
+
         cls._heap_stats = rgc._heap_stats
         rgc._heap_stats = fake_heap_stats
         fname = udir.join('gcdump.log')
@@ -94,10 +96,10 @@
     def teardown_class(cls):
         import py
         from rpython.rlib import rgc
-        
+
         rgc._heap_stats = cls._heap_stats
         assert py.path.local(cls._fname).read() == '1 12 0,0\n2 10 10,0\n'
-    
+
     def test_gc_heap_stats(self):
         import gc
         gc.dump_heap_stats(self.fname)
@@ -124,6 +126,7 @@
         for r in rlist:
             assert r() is None
 
+
 class AppTestGcMapDictIndexCache(AppTestGcMethodCache):
     spaceconfig = {"objspace.std.withmethodcache": True,
                    "objspace.std.withmapdict": True}
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to