mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 03:50:16 +00:00
some fix
This commit is contained in:
parent
8f114ad816
commit
d7c38f95b5
@ -95,7 +95,7 @@ bool VM::py_ge(PyVar _0, PyVar _1){
|
|||||||
|
|
||||||
#define DISPATCH() { frame->_ip++; goto __NEXT_STEP; }
|
#define DISPATCH() { frame->_ip++; goto __NEXT_STEP; }
|
||||||
#define DISPATCH_JUMP(__target) { frame->_ip = __target; goto __NEXT_STEP; }
|
#define DISPATCH_JUMP(__target) { frame->_ip = __target; goto __NEXT_STEP; }
|
||||||
#define RETURN_OP_YIELD() { frame->_ip++; return PY_OP_YIELD; }
|
#define RETURN_OP_YIELD() { return PY_OP_YIELD; }
|
||||||
|
|
||||||
PyVar VM::__run_top_frame(){
|
PyVar VM::__run_top_frame(){
|
||||||
Frame* frame = &callstack.top();
|
Frame* frame = &callstack.top();
|
||||||
|
@ -106,11 +106,6 @@ def test(*seq):
|
|||||||
return s1.join(seq)
|
return s1.join(seq)
|
||||||
assert test("r", "u", "n", "o", "o", "b") == "r-u-n-o-o-b"
|
assert test("r", "u", "n", "o", "o", "b") == "r-u-n-o-o-b"
|
||||||
|
|
||||||
def f():
|
|
||||||
for i in range(5):
|
|
||||||
yield str(i)
|
|
||||||
assert '|'.join(f()) == '0|1|2|3|4'
|
|
||||||
|
|
||||||
num = 6
|
num = 6
|
||||||
assert str(num) == '6'
|
assert str(num) == '6'
|
||||||
|
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
def g():
|
||||||
|
yield 1
|
||||||
|
yield 2
|
||||||
|
|
||||||
|
a = g()
|
||||||
|
assert next(a) == 1
|
||||||
|
assert next(a) == 2
|
||||||
|
|
||||||
def f(n):
|
def f(n):
|
||||||
for i in range(n):
|
for i in range(n):
|
||||||
yield i
|
yield i
|
||||||
@ -38,6 +46,13 @@ def f():
|
|||||||
a = [i for i in f()]
|
a = [i for i in f()]
|
||||||
assert a == [1, 2, 3]
|
assert a == [1, 2, 3]
|
||||||
|
|
||||||
|
|
||||||
|
def f():
|
||||||
|
for i in range(5):
|
||||||
|
yield str(i)
|
||||||
|
assert '|'.join(f()) == '0|1|2|3|4'
|
||||||
|
|
||||||
|
|
||||||
def f(n):
|
def f(n):
|
||||||
for i in range(n):
|
for i in range(n):
|
||||||
yield i
|
yield i
|
||||||
|
Loading…
x
Reference in New Issue
Block a user