Skip to content

Commit 24176f7

Browse files
committed
Add more test for bytearray.pop and fix the panic message
1 parent bfdb82b commit 24176f7

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

tests/snippets/bytearray.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,12 @@
4343
assert len(c) == 3
4444
c.pop()
4545
assert len(c) == 2
46+
c.pop()
47+
c.pop()
48+
49+
try:
50+
c.pop()
51+
except IndexError:
52+
pass
53+
else:
54+
assert False

vm/src/obj/objbytes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ pub fn get_value<'a>(obj: &'a PyObjectRef) -> impl Deref<Target = Vec<u8>> + 'a
185185
if let PyObjectPayload::Bytes { ref value } = py_obj.payload {
186186
value
187187
} else {
188-
panic!("Inner error getting int {:?}", obj);
188+
panic!("Inner error getting bytearray {:?}", obj);
189189
}
190190
})
191191
}
@@ -195,7 +195,7 @@ pub fn get_mut_value<'a>(obj: &'a PyObjectRef) -> impl DerefMut<Target = Vec<u8>
195195
if let PyObjectPayload::Bytes { ref mut value } = py_obj.payload {
196196
value
197197
} else {
198-
panic!("Inner error getting int {:?}", obj);
198+
panic!("Inner error getting bytearray {:?}", obj);
199199
}
200200
})
201201
}

0 commit comments

Comments
 (0)