@@ -89,7 +89,7 @@ fn file_io_read_into(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
89
89
arg_check ! (
90
90
vm,
91
91
args,
92
- required = [ ( file_io, None ) , ( view, Some ( vm. ctx. bytes_type ( ) ) ) ]
92
+ required = [ ( file_io, None ) , ( view, Some ( vm. ctx. bytearray_type ( ) ) ) ]
93
93
) ;
94
94
let py_name = file_io. get_attr ( "name" ) . unwrap ( ) ;
95
95
let f = match File :: open ( get_value ( & py_name) ) {
@@ -117,6 +117,8 @@ fn file_io_read_into(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
117
117
118
118
fn buffered_reader_read ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> PyResult {
119
119
arg_check ! ( vm, args) ;
120
+
121
+ //simple calls read on the read class!
120
122
// TODO
121
123
Ok ( vm. get_none ( ) )
122
124
}
@@ -130,6 +132,7 @@ fn io_open(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
130
132
131
133
132
134
Ok ( vm. get_none ( ) )
135
+
133
136
//mode is optional: 'rt' is the default mode (open from reading text)
134
137
//To start we construct a FileIO (subclass of RawIOBase)
135
138
//This is subsequently consumed by a Buffered_class of type depending
@@ -139,6 +142,7 @@ fn io_open(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
139
142
// reading => BufferedReader
140
143
// If the mode is binary this Buffered class is returned directly at
141
144
// this point.
145
+ //For Buffered class construct "raw" IO class e.g. FileIO and pass this into corresponding field
142
146
143
147
//If the mode is text this buffer type is consumed on construction of
144
148
//a TextIOWrapper which is subsequently returned.
@@ -168,7 +172,7 @@ pub fn mk_module(ctx: &PyContext) -> PyObjectRef {
168
172
ctx. set_attr ( & file_io, "__init__" , ctx. new_rustfunc ( file_io_init) ) ;
169
173
ctx. set_attr ( & file_io, "name" , ctx. str_type ( ) ) ;
170
174
ctx. set_attr ( & file_io, "read" , ctx. new_rustfunc ( file_io_read) ) ;
171
- ctx. set_attr ( & file_io, "read_into " , ctx. new_rustfunc ( file_io_read_into) ) ;
175
+ ctx. set_attr ( & file_io, "readinto " , ctx. new_rustfunc ( file_io_read_into) ) ;
172
176
ctx. set_attr ( & py_mod, "FileIO" , file_io. clone ( ) ) ;
173
177
174
178
// BufferedIOBase Subclasses
0 commit comments