summaryrefslogtreecommitdiff
path: root/odoo/tools/safe_eval.py
diff options
context:
space:
mode:
authorjaredkipe <jared@jaredkipe.com>2017-10-03 17:51:24 +0200
committerXavier Morel <xmo@odoo.com>2017-10-17 16:16:42 +0200
commitd7cfa8c502f27bee5c2fccb35db47b08e3b3804b (patch)
tree1325a143735951e13b7ac67eae262d8161d8f322 /odoo/tools/safe_eval.py
parentc30f8c50a3f4492c68f7cc4c2c1ce6cb5bf5350b (diff)
[FIX]: safe_eval’ing some large scripts yield illegal opcodes
Following the 3.6 wordcode change, EXTENDED_ARGS gets used for jumps offset by more than 256 bytes (128 opcodes), most commonly absolute (so many script of more than 128 opcodes with conditionals arer going to trigger the issue). In bytecoded Python versions, EXTENDED_ARGS was only necessary above 65k opcodes: the opcode would get a separate 16-bits argument, while wordcode opcodes get 8-bit intrinsic.
Diffstat (limited to 'odoo/tools/safe_eval.py')
-rw-r--r--odoo/tools/safe_eval.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/odoo/tools/safe_eval.py b/odoo/tools/safe_eval.py
index fec89fac087..7f5d6e35e71 100644
--- a/odoo/tools/safe_eval.py
+++ b/odoo/tools/safe_eval.py
@@ -96,6 +96,7 @@ _SAFE_OPCODES = _EXPR_OPCODES.union(set(opmap[x] for x in [
'POP_BLOCK', 'POP_EXCEPT', # Seems to be a special-case of POP_BLOCK for P3
'SETUP_LOOP', 'BREAK_LOOP', 'CONTINUE_LOOP',
'MAKE_FUNCTION', 'CALL_FUNCTION',
+ 'EXTENDED_ARG', # P3.6 for long jump offsets.
# P3: https://bugs.python.org/issue27213
'CALL_FUNCTION_EX',
# Already in P2 but apparently the first one is used more aggressively in P3