[pypy-svn] r34205 - in pypy/branch/refactor-file/pypy: module/_file rlib

cfbolz at codespeak.net cfbolz at codespeak.net
Sat Nov 4 18:57:41 CET 2006


Author: cfbolz
Date: Sat Nov  4 18:57:40 2006
New Revision: 34205

Modified:
   pypy/branch/refactor-file/pypy/module/_file/interp_file.py
   pypy/branch/refactor-file/pypy/rlib/streamio.py
Log:
(guido, cfbolz): ouch


Modified: pypy/branch/refactor-file/pypy/module/_file/interp_file.py
==============================================================================
--- pypy/branch/refactor-file/pypy/module/_file/interp_file.py	(original)
+++ pypy/branch/refactor-file/pypy/module/_file/interp_file.py	Sat Nov  4 18:57:40 2006
@@ -27,7 +27,7 @@
     def __init__(self, space, stream):
         self.stream = stream
 
-for name, argtypes in streamio.STREAM_METHODS:
+for name, argtypes in streamio.STREAM_METHODS.iteritems():
     numargs = len(argtypes)
     args = ", ".join(["v%s" % i for i in range(numargs)])
     exec py.code.Source("""
@@ -44,7 +44,7 @@
 
 W_Stream.typedef = TypeDef("Stream",
     **dict([(name, interp2app(globals()[name]))
-                for name, _ in streamio.STREAM_METHODS]))
+                for name, _ in streamio.STREAM_METHODS.iteritems()]))
 
 
 def is_mode_ok(space, mode):

Modified: pypy/branch/refactor-file/pypy/rlib/streamio.py
==============================================================================
--- pypy/branch/refactor-file/pypy/rlib/streamio.py	(original)
+++ pypy/branch/refactor-file/pypy/rlib/streamio.py	Sat Nov  4 18:57:40 2006
@@ -340,7 +340,7 @@
 
 # ____________________________________________________________
 
-STREAM_METHODS = [
+STREAM_METHODS = dict([
     ("read", [int]),
     ("write", [str]),
     ("tell", []),
@@ -352,13 +352,14 @@
     ("close", []),
     ("peek", []),
     ("try_to_find_file_descriptor", []),
-    ]
+    ])
 
 def PassThrough(meth_name, flush_buffers):
     if meth_name in STREAM_METHODS:
         signature = STREAM_METHODS[meth_name]
         args = ", ".join(["v%s" % (i, ) for i in range(len(signature))])
     else:
+        assert 0, "not a good idea"
         args = "*args"
     if flush_buffers:
         code = """def %s(self, %s):



More information about the Pypy-commit mailing list