[FIX] core: assert _get_func_code code argument

closes odoo/odoo#33682

Signed-off-by: bve-odoo <bve@odoo.com>
This commit is contained in:
jorv
2023-08-28 15:15:19 +00:00
parent 4d1a1f1c99
commit 16179c9399
+10
View File
@@ -2,10 +2,12 @@ import ast
import os
import logging
from shutil import copyfileobj
from types import CodeType
_logger = logging.getLogger(__name__)
from werkzeug.datastructures import FileStorage
from werkzeug.routing import Rule
from werkzeug.wrappers import Request, Response
from .json import scriptsafe
@@ -33,6 +35,14 @@ FileStorage.save = lambda self, dst, buffer_size=1<<20: copyfileobj(self.stream,
Request.json_module = Response.json_module = scriptsafe
get_func_code = getattr(Rule, '_get_func_code', None)
if get_func_code:
@staticmethod
def _get_func_code(code, name):
assert isinstance(code, CodeType)
return get_func_code(code, name)
Rule._get_func_code = _get_func_code
orig_literal_eval = ast.literal_eval
def literal_eval(expr):