File tree 2 files changed +19
-8
lines changed
2 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -324,6 +324,17 @@ def stack_push_int(self) -> Callable[[int], None]:
324
324
@cached_property
325
325
def stack_push_bytes (self ) -> Callable [[bytes ], None ]:
326
326
return self ._stack .push_bytes
327
+
328
+ #
329
+ # Return Stack Management
330
+ #
331
+ @cached_property
332
+ def rstack_push_int (self ) -> Callable [[int ], None ]:
333
+ return self ._rstack .push_int
334
+
335
+ @cached_property
336
+ def rstack_pop1_int (self ) -> Callable [[int ]], None ]:
337
+ return self ._rstack .pop1_int
327
338
328
339
#
329
340
# Computation result
Original file line number Diff line number Diff line change 23
23
For the same reason, the class RStack doesn't inherit from the abc StackAPI, as it would require to implement all the abstract methods defined.
24
24
"""
25
25
26
+
27
+ def _busted_type (item_type : type , value : Union [int , bytes ]) -> ValidationError :
28
+ return ValidationError (
29
+ "Stack must always be bytes or int, "
30
+ f"got { item_type !r} type, val { value !r} "
31
+ )
32
+
26
33
class RStack ():
27
34
"""
28
35
VM Return Stack
@@ -46,7 +53,7 @@ def push_int(self) -> int:
46
53
self ._append ((int , value ))
47
54
48
55
49
- def pop1_int (self ) -> int :
56
+ def pop1_int (self ) -> int :
50
57
#
51
58
# Note: This function is optimized for speed over readability.
52
59
#
@@ -61,10 +68,3 @@ def pop1_int(self) -> int:
61
68
else :
62
69
raise _busted_type (item_type , popped )
63
70
64
- def _busted_type (item_type : type , value : Union [int , bytes ]) -> ValidationError :
65
- return ValidationError (
66
- "Stack must always be bytes or int, "
67
- f"got { item_type !r} type, val { value !r} "
68
- )
69
-
70
-
You can’t perform that action at this time.
0 commit comments