Skip to content

Commit dfc50dc

Browse files
committed
Clear buffered_io_base
1 parent 2862845 commit dfc50dc

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

vm/src/stdlib/io.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,12 +1147,7 @@ pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
11471147
"read" => ctx.new_method(raw_io_base_read),
11481148
});
11491149

1150-
let buffered_io_base = py_class!(ctx, "_BufferedIOBase", io_base.clone(), {
1151-
"__init__" => ctx.new_method(buffered_io_base_init),
1152-
"fileno" => ctx.new_method(buffered_io_base_fileno),
1153-
"name" => ctx.new_readonly_getset("name", buffered_io_base_name),
1154-
"mode" => ctx.new_readonly_getset("mode", buffered_io_base_mode),
1155-
});
1150+
let buffered_io_base = py_class!(ctx, "_BufferedIOBase", io_base.clone(), {});
11561151

11571152
//TextIO Base has no public constructor
11581153
let text_io_base = py_class!(ctx, "_TextIOBase", io_base.clone(), {});
@@ -1162,19 +1157,26 @@ pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
11621157
//workaround till the buffered classes can be fixed up to be more
11631158
//consistent with the python model
11641159
//For more info see: https://github.com/RustPython/RustPython/issues/547
1160+
"__init__" => ctx.new_method(buffered_io_base_init),
11651161
"read" => ctx.new_method(buffered_reader_read),
11661162
"seekable" => ctx.new_method(buffered_reader_seekable),
11671163
"seek" => ctx.new_method(buffered_reader_seek),
11681164
"tell" => ctx.new_method(buffered_reader_tell),
11691165
"close" => ctx.new_method(buffered_reader_close),
1166+
"fileno" => ctx.new_method(buffered_io_base_fileno),
1167+
"name" => ctx.new_readonly_getset("name", buffered_io_base_name),
1168+
"mode" => ctx.new_readonly_getset("mode", buffered_io_base_mode),
11701169
});
11711170

11721171
let buffered_writer = py_class!(ctx, "BufferedWriter", buffered_io_base.clone(), {
11731172
//workaround till the buffered classes can be fixed up to be more
11741173
//consistent with the python model
11751174
//For more info see: https://github.com/RustPython/RustPython/issues/547
1175+
"__init__" => ctx.new_method(buffered_io_base_init),
11761176
"write" => ctx.new_method(buffered_writer_write),
11771177
"seekable" => ctx.new_method(buffered_writer_seekable),
1178+
"name" => ctx.new_readonly_getset("name", buffered_io_base_name),
1179+
"mode" => ctx.new_readonly_getset("mode", buffered_io_base_mode),
11781180
});
11791181

11801182
//TextIOBase Subclass

0 commit comments

Comments
 (0)