[Bf-blender-cvs] [dfa52017638] master: Python: add opcodes for safe py-drivers
Campbell Barton
noreply at git.blender.org
Tue Jul 5 06:00:14 CEST 2022
Commit: dfa52017638abdf59791e5588c439d3a558a191d
Author: Campbell Barton
Date: Tue Jul 5 13:41:53 2022 +1000
Branches: master
https://developer.blender.org/rBdfa52017638abdf59791e5588c439d3a558a191d
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
===================================================================
M source/blender/python/intern/bpy_driver.c
===================================================================
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),
More information about the Bf-blender-cvs
mailing list