Skip to content

Commit 5f1290d

Browse files
authored
Implement properties on _TextIOBase and StringIO (#5987)
1 parent 63e6c01 commit 5f1290d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Lib/test/test_memoryio.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -940,8 +940,6 @@ def test_relative_seek(self):
940940
def test_seek(self):
941941
super().test_seek()
942942

943-
# TODO: RUSTPYTHON
944-
@unittest.expectedFailure
945943
def test_textio_properties(self):
946944
super().test_textio_properties()
947945

@@ -1046,8 +1044,6 @@ def test_newlines_property(self):
10461044
def test_relative_seek(self):
10471045
super().test_relative_seek()
10481046

1049-
# TODO: RUSTPYTHON
1050-
@unittest.expectedFailure
10511047
def test_textio_properties(self):
10521048
super().test_textio_properties()
10531049

vm/src/stdlib/io.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,11 @@ mod _io {
738738
fn encoding(_zelf: PyObjectRef, vm: &VirtualMachine) -> PyObjectRef {
739739
vm.ctx.none()
740740
}
741+
742+
#[pygetset]
743+
fn errors(_zelf: PyObjectRef, vm: &VirtualMachine) -> PyObjectRef {
744+
vm.ctx.none()
745+
}
741746
}
742747

743748
#[derive(FromArgs, Clone)]
@@ -3594,6 +3599,11 @@ mod _io {
35943599
let pos = pos.try_usize(vm)?;
35953600
Ok(buffer.truncate(pos))
35963601
}
3602+
3603+
#[pygetset]
3604+
fn line_buffering(&self) -> bool {
3605+
false
3606+
}
35973607
}
35983608

35993609
#[pyattr]

0 commit comments

Comments
 (0)