Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-07-05 06:41:53 +0300
committerCampbell Barton <campbell@blender.org>2022-07-05 06:41:53 +0300
commitdfa52017638abdf59791e5588c439d3a558a191d (patch)
treed5241e04c239cc7fd555b9933b282655e0d8adaf /source/blender/python/intern/bpy_driver.c
parent7537369498bf61f872554b0ce2efc439008165a4 (diff)
Python: add opcodes for safe py-drivers
New opcodes added since 3.7 meant some actions such as `len()` were disabled in safe py-driver execution. The following opcodes have been added, see [0] for details: - ROT_FOUR: similar to existing ROT_* opcodes, added v3.8. - ROT_N: similar to existing ROT_* opcodes, added v3.10. - GET_LEN: Push len(TOS) onto the stack, added v3.10. - IS_OP: for ternary operator, added v3.9. - BUILD_SLICE: access `slice` built-in, doesn't expose new functionality beyond existing `__getitem__` access. [0]: https://docs.python.org/3.10/library/dis.html
Diffstat (limited to 'source/blender/python/intern/bpy_driver.c')
-rw-r--r--source/blender/python/intern/bpy_driver.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c
index a9cc0019783..05def07a6d7 100644
--- a/source/blender/python/intern/bpy_driver.c
+++ b/source/blender/python/intern/bpy_driver.c
@@ -290,6 +290,7 @@ static const char secure_opcodes[255] = {
OK_OP(ROT_THREE),
OK_OP(DUP_TOP),
OK_OP(DUP_TOP_TWO),
+ OK_OP(ROT_FOUR),
OK_OP(NOP),
OK_OP(UNARY_POSITIVE),
OK_OP(UNARY_NEGATIVE),
@@ -307,6 +308,7 @@ static const char secure_opcodes[255] = {
OK_OP(BINARY_TRUE_DIVIDE),
OK_OP(INPLACE_FLOOR_DIVIDE),
OK_OP(INPLACE_TRUE_DIVIDE),
+ OK_OP(GET_LEN),
OK_OP(INPLACE_ADD),
OK_OP(INPLACE_SUBTRACT),
OK_OP(INPLACE_MULTIPLY),
@@ -323,6 +325,7 @@ static const char secure_opcodes[255] = {
OK_OP(INPLACE_XOR),
OK_OP(INPLACE_OR),
OK_OP(RETURN_VALUE),
+ OK_OP(ROT_N),
OK_OP(BUILD_TUPLE),
OK_OP(BUILD_LIST),
OK_OP(BUILD_SET),
@@ -335,9 +338,11 @@ static const char secure_opcodes[255] = {
OK_OP(POP_JUMP_IF_FALSE),
OK_OP(POP_JUMP_IF_TRUE),
OK_OP(LOAD_GLOBAL),
+ OK_OP(IS_OP),
OK_OP(LOAD_FAST),
OK_OP(STORE_FAST),
OK_OP(DELETE_FAST),
+ OK_OP(BUILD_SLICE),
OK_OP(LOAD_DEREF),
OK_OP(STORE_DEREF),