Skip to content

Commit 724d9c6

Browse files
committed
Fixed Inheritance on String & BytesIO to reflect CPython
1 parent fcea845 commit 724d9c6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

vm/src/stdlib/io.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,18 +421,18 @@ pub fn mk_module(ctx: &PyContext) -> PyObjectRef {
421421
};
422422
ctx.set_attr(&py_mod, "TextIOWrapper", text_io_wrapper.clone());
423423

424-
// BytesIO: in-memory bytes
424+
//StringIO: in-memory text
425425
let string_io = {
426-
let string_io = ctx.new_class("StringIO", io_base.clone());
426+
let string_io = ctx.new_class("StringIO", text_io_base.clone());
427427
ctx.set_attr(&string_io, "__init__", ctx.new_rustfunc(string_io_init));
428428
ctx.set_attr(&string_io, "getvalue", ctx.new_rustfunc(string_io_getvalue));
429429
string_io
430430
};
431431
ctx.set_attr(&py_mod, "StringIO", string_io);
432432

433-
// StringIO: in-memory text
433+
//BytesIO: in-memory bytes
434434
let bytes_io = {
435-
let bytes_io = ctx.new_class("BytesIO", io_base.clone());
435+
let bytes_io = ctx.new_class("BytesIO", buffered_io_base.clone());
436436
ctx.set_attr(&bytes_io, "__init__", ctx.new_rustfunc(bytes_io_init));
437437
ctx.set_attr(&bytes_io, "getvalue", ctx.new_rustfunc(bytes_io_getvalue));
438438
bytes_io

0 commit comments

Comments
 (0)