[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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user