From 0181e2b3804d57e331ad555a9ae5c1d25f3c652e Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Mon, 15 Aug 2022 04:18:49 +0900 Subject: [PATCH] io.text_encoding return utf-8 for RustPython for now --- Lib/test/test_pathlib.py | 4 ---- vm/src/stdlib/io.rs | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 67c535963..5976de517 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -1535,8 +1535,6 @@ class _BasePathTest(object): self.assertIs(False, P(BASE + '\udfff').exists()) self.assertIs(False, P(BASE + '\x00').exists()) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_open_common(self): p = self.cls(BASE) with (p / 'fileA').open('r') as f: @@ -1566,8 +1564,6 @@ class _BasePathTest(object): self.assertRaises(TypeError, (p / 'fileA').write_text, b'somebytes') self.assertEqual((p / 'fileA').read_text(encoding='latin-1'), 'äbcdefg') - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_write_text_with_newlines(self): p = self.cls(BASE) # Check that `\n` character change nothing diff --git a/vm/src/stdlib/io.rs b/vm/src/stdlib/io.rs index 0e17f7bfe..d747d8034 100644 --- a/vm/src/stdlib/io.rs +++ b/vm/src/stdlib/io.rs @@ -3676,7 +3676,8 @@ mod _io { vm: &VirtualMachine, ) -> PyResult { if vm.is_none(&encoding) { - return Ok(vm.ctx.new_str("locale")); + // TODO: This is `locale` encoding - but we don't have locale encoding yet + return Ok(vm.ctx.new_str("utf-8")); } encoding.try_into_value(vm) }