diff options
| author | Olivier Laurent <olilau@gmail.com> | 2018-07-30 09:49:59 +0200 |
|---|---|---|
| committer | xmo-odoo <xmo@odoo.com> | 2018-07-30 09:49:59 +0200 |
| commit | 8ee329c1dcc47c55f2243a7bc2752097f17c98f5 (patch) | |
| tree | da9821e52e1ba8c5d245dbfc02496d16308330f0 | |
| parent | dc253ff1c65029e3795c1e49da0b16aa9e90db2a (diff) | |
[FIX] P3: add missing opcode
In Python 3, SETUP_FINALLY is used if the exception object is bound in
the except block — even if there is no finally block — in order to
unbind and cleanup the exception's binding as part of PEP 3110:
https://www.python.org/dev/peps/pep-3110/#semantic-changes
This allows both using exception objects in Python 3 and using
finally blocks in both version.
opw 1824211
| -rw-r--r-- | odoo/tools/safe_eval.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/odoo/tools/safe_eval.py b/odoo/tools/safe_eval.py index 7a5ec03707a..ccb2e3e25b4 100644 --- a/odoo/tools/safe_eval.py +++ b/odoo/tools/safe_eval.py @@ -107,8 +107,8 @@ _SAFE_OPCODES = _EXPR_OPCODES.union(set(opmap[x] for x in [ 'JUMP_FORWARD', 'JUMP_IF_TRUE', 'JUMP_IF_FALSE', 'JUMP_ABSOLUTE', # New in Python 2.7 - http://bugs.python.org/issue4715 : 'JUMP_IF_FALSE_OR_POP', 'JUMP_IF_TRUE_OR_POP', 'POP_JUMP_IF_FALSE', - 'POP_JUMP_IF_TRUE', 'SETUP_EXCEPT', 'END_FINALLY', 'RAISE_VARARGS', - 'LOAD_NAME', 'STORE_NAME', 'DELETE_NAME', 'LOAD_ATTR', + 'POP_JUMP_IF_TRUE', 'SETUP_EXCEPT', 'SETUP_FINALLY', 'END_FINALLY', + 'RAISE_VARARGS', 'LOAD_NAME', 'STORE_NAME', 'DELETE_NAME', 'LOAD_ATTR', 'LOAD_FAST', 'STORE_FAST', 'DELETE_FAST', 'UNPACK_SEQUENCE', 'LOAD_GLOBAL', # Only allows access to restricted globals ] if x in opmap)) |
