From b32f231e3354e77aaeccb62a64b82c077d5f821f Mon Sep 17 00:00:00 2001 From: TheHellTower Date: Fri, 20 Oct 2023 16:42:33 -0400 Subject: [PATCH] Add `GEN_START` support (#392) * Apparently should be enough ? * Add `GEN_START` test * Add `GEN_START` test compiled * Add `GEN_START` test tokenized * Smaller test since only POP is needed. * Smaller test since only POP is needed. * Smaller test since only POP is needed. * dos2unix --- ASTree.cpp | 3 +++ tests/compiled/GEN_START.3.10.pyc | Bin 0 -> 219 bytes tests/input/GEN_START.py | 2 ++ tests/tokenized/GEN_START.txt | 3 +++ 4 files changed, 8 insertions(+) create mode 100644 tests/compiled/GEN_START.3.10.pyc create mode 100644 tests/input/GEN_START.py create mode 100644 tests/tokenized/GEN_START.txt diff --git a/ASTree.cpp b/ASTree.cpp index 63a894e..c2794d3 100644 --- a/ASTree.cpp +++ b/ASTree.cpp @@ -2419,6 +2419,9 @@ PycRef BuildFromCode(PycRef code, PycModule* mod) case Pyc::PUSH_NULL: stack.push(nullptr); break; + case Pyc::GEN_START_A: + stack.pop(); + break; default: fprintf(stderr, "Unsupported opcode: %s\n", Pyc::OpcodeName(opcode & 0xFF)); cleanBuild = false; diff --git a/tests/compiled/GEN_START.3.10.pyc b/tests/compiled/GEN_START.3.10.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bacb6090033a79cf4ebcd5ebbae1c31c0fbec8a8 GIT binary patch literal 219 zcmd1j<>g`k0@wRSsj@)&F^Gc(44TZzKoJzc2;_kT z!D<_UYQq>9fqH;ynfzXYRIX$w0-1*(e(|`w`o#x_I0l926;$5hg!4c~6|(>drUov? hA`rt*6G9_2Ls-l}xmz4Ix%nxjIjMGFeIPq{7yz|19%%po literal 0 HcmV?d00001 diff --git a/tests/input/GEN_START.py b/tests/input/GEN_START.py new file mode 100644 index 0000000..d4b2b35 --- /dev/null +++ b/tests/input/GEN_START.py @@ -0,0 +1,2 @@ +def GEN_START(): + yield 0 diff --git a/tests/tokenized/GEN_START.txt b/tests/tokenized/GEN_START.txt new file mode 100644 index 0000000..8f5a315 --- /dev/null +++ b/tests/tokenized/GEN_START.txt @@ -0,0 +1,3 @@ +def GEN_START ( ) : + +yield 0