Permalink
Browse files

Add greenlet support

  • Loading branch information...
rday committed Sep 5, 2016
1 parent 09eae5a commit 1ed65d55a5ba2e3eaf1420e563235995688ce711
View
@@ -42,17 +42,18 @@ build/hostpython: | dl/$(TARBALL)
mv build/python build/hostpython
build/Parser/hostpgen: build/hostpython
- mv build/Parser/pgen build/Parser/hostpgen
+ cp build/Parser/pgen build/Parser/hostpgen
build/Programs/host_freeze_importlib: build/Parser/hostpgen
- mv build/Programs/_freeze_importlib build/Programs/host_freeze_importlib
+ cp build/Programs/_freeze_importlib build/Programs/host_freeze_importlib
build/configure: build/Programs/host_freeze_importlib
(cd build; make distclean)
build/stamp_patch: build/configure patches/*
cp config.site build/
(cd build && ../../scripts/apply-patches.sh ./ ../patches/*)
+ cp -R files/* build/Modules/
touch $@
build/Makefile: build/stamp_patch
View
@@ -21,6 +21,9 @@ but not everything. If you have an ImportError while trying to import a module
you feel should exist, please examine the `build/Modules/Setup` file to make
sure it is compiled into Python.
+[Greenlets](https://greenlet.readthedocs.io/en/latest/) support is built into this
+package. Greenlets are like coroutines. The example script includes greenlets so
+you can see how they operate.
Instructions
============
View
@@ -9,6 +9,8 @@
import json
import csv
+from greenlet import greenlet
+
def hello_world():
print("\n" * 4)
@@ -27,6 +29,21 @@ def hello_world():
print("\n" * 2)
+
+def test1():
+ print(12)
+ gr2.switch()
+ print(34)
+
+def test2():
+ print(56)
+ gr1.switch()
+ print(78)
+
+
+gr1 = greenlet(test1)
+gr2 = greenlet(test2)
+
if __name__ == '__main__':
hello_world()
-
+ gr1.switch()
Oops, something went wrong.

0 comments on commit 1ed65d5

Please sign in to comment.