Explorar el Código

Update 1_5_0.md

blueloveTH hace 1 año
padre
commit
7aef0a3d5a
Se han modificado 1 ficheros con 2 adiciones y 0 borrados
  1. 2 0
      docs/1_5_0.md

+ 2 - 0
docs/1_5_0.md

@@ -93,6 +93,7 @@ For example:
 
 ```cpp
 vm->bind__next__(type, [](VM* vm, PyObject* _0){
+    if(is_end) return vm->StopIteration;
     // ...
     PyObject* a = VAR(1);
     PyObject* b = VAR(2);
@@ -111,6 +112,7 @@ In `v1.5.0`, you need to use stack-based style to reimplement the above code:
 
 ```cpp
 vm->bind__next__(type, [](VM* vm, PyObject* _0) -> unsigned{
+    if(is_end) return 0;    // return 0 indicates StopIteration
     // ...
     PyObject* a = VAR(1);
     PyObject* b = VAR(2);