File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -104,8 +104,6 @@ def test_bytes(self):
104
104
self .helper (s )
105
105
106
106
class ExceptionTestCase (unittest .TestCase ):
107
- # TODO: RUSTPYTHON
108
- @unittest .expectedFailure
109
107
def test_exceptions (self ):
110
108
new = marshal .loads (marshal .dumps (StopIteration ))
111
109
self .assertEqual (StopIteration , new )
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ mod decl {
23
23
None = b'N' ,
24
24
False = b'F' ,
25
25
True = b'T' ,
26
- // StopIter = b'S',
26
+ StopIter = b'S' ,
27
27
Ellipsis = b'.' ,
28
28
Int = b'i' ,
29
29
Float = b'g' ,
@@ -57,7 +57,7 @@ mod decl {
57
57
b'N' => None ,
58
58
b'F' => False ,
59
59
b'T' => True ,
60
- // b'S' => StopIter,
60
+ b'S' => StopIter ,
61
61
b'.' => Ellipsis ,
62
62
b'i' => Int ,
63
63
b'g' => Float ,
@@ -112,6 +112,8 @@ mod decl {
112
112
fn dump_obj ( buf : & mut Vec < u8 > , value : PyObjectRef , vm : & VirtualMachine ) -> PyResult < ( ) > {
113
113
if vm. is_none ( & value) {
114
114
buf. push ( Type :: None as u8 ) ;
115
+ } else if value. is ( vm. ctx . exceptions . stop_iteration ) {
116
+ buf. push ( Type :: StopIter as u8 ) ;
115
117
} else if value. is ( & vm. ctx . ellipsis ) {
116
118
buf. push ( Type :: Ellipsis as u8 ) ;
117
119
} else {
@@ -277,6 +279,10 @@ mod decl {
277
279
Type :: True => ( true . to_pyobject ( vm) , buf) ,
278
280
Type :: False => ( false . to_pyobject ( vm) , buf) ,
279
281
Type :: None => ( vm. ctx . none ( ) , buf) ,
282
+ Type :: StopIter => (
283
+ vm. ctx . exceptions . stop_iteration . to_owned ( ) . to_pyobject ( vm) ,
284
+ buf,
285
+ ) ,
280
286
Type :: Ellipsis => ( vm. ctx . ellipsis ( ) , buf) ,
281
287
Type :: Int => {
282
288
if buf. len ( ) < 4 {
You can’t perform that action at this time.
0 commit comments