From 4b659f92aa70fab29f67e25aa6df951ecacbd453 Mon Sep 17 00:00:00 2001 From: kimnanhee Date: Sat, 16 Jul 2022 15:38:21 +0900 Subject: [PATCH] Fix byte indices must be integers or slices, error message --- Lib/test/test_bytes.py | 2 -- vm/src/builtins/bytes.rs | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py index ed5ed58392..bdc9168be2 100644 --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -989,8 +989,6 @@ def test_sq_item(self): class BytesTest(BaseBytesTest, unittest.TestCase): type2test = bytes - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_getitem_error(self): b = b'python' msg = "byte indices must be integers or slices" diff --git a/vm/src/builtins/bytes.rs b/vm/src/builtins/bytes.rs index 67dfeef250..32bdcf5553 100644 --- a/vm/src/builtins/bytes.rs +++ b/vm/src/builtins/bytes.rs @@ -167,7 +167,7 @@ impl PyBytes { } fn _getitem(&self, needle: &PyObject, vm: &VirtualMachine) -> PyResult { - match SequenceIndex::try_from_borrowed_object(vm, needle, "bytes")? { + match SequenceIndex::try_from_borrowed_object(vm, needle, "byte")? { SequenceIndex::Int(i) => self .inner .elements