Pārlūkot izejas kodu

Update precompile.md

blueloveTH 1 gadu atpakaļ
vecāks
revīzija
2b74fc847e
2 mainītis faili ar 8 papildinājumiem un 17 dzēšanām
  1. 8 3
      docs/features/precompile.md
  2. 0 14
      tests/94_compile.py

+ 8 - 3
docs/features/precompile.md

@@ -3,7 +3,7 @@ icon: dot
 title: Precompiling
 ---
 
-pkpy allows you to precompile your python code into a special form, which can be executed later.
+pkpy allows you to precompile python code into two special forms, which can be executed later.
 
 ### In-memory precompilation
 
@@ -15,8 +15,9 @@ CodeObject_ code = vm->compile("print('Hello, world!')", "<string>", EXEC_MODE);
 vm->_exec(code);        // Hello, world!
 ```
 
-This `CodeObject_` object is a very non-generic form of the compiled code.
-It is an in-memory form. You are not able to save it to a file or load it from a file.
+This `CodeObject_` object is a very non-generic form of the compiled code,
+which is an in-memory form. Very efficient, but not portable.
+You are not able to save it to a file or load it from a file.
 
 
 ### String precompilation
@@ -112,3 +113,7 @@ Traceback (most recent call last):
     return g(a, b)
 StackOverflowError
 ```
+
+!!!
+String compilation has no guarantee of compatibility between different versions of pkpy.
+!!!

+ 0 - 14
tests/94_compile.py

@@ -1,16 +1,2 @@
 code = compile("1+2", "<eval>", "eval")
 assert eval(code) == 3
-
-src = """
-def f(a, b):
-    return g(a, b)
-
-def g(a, b):
-    c = f(a, b)
-    d = g(a, b)
-    return c + d
-"""
-
-code = compile(src, "<12>", "exec")
-exec(code)
-f(1, 2)