feat: add in support for _inplacevar_ (#31921)
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
parent
2c3603c270
commit
9a94e73489
2 changed files with 4 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ from typing import TYPE_CHECKING, Any
|
|||
|
||||
import orjson
|
||||
import RestrictedPython.Guards
|
||||
from AccessControl.ZopeGuards import protected_inplacevar
|
||||
from RestrictedPython import PrintCollector, compile_restricted, safe_globals
|
||||
from RestrictedPython.transformer import RestrictingNodeTransformer
|
||||
|
||||
|
|
@ -313,6 +314,7 @@ def get_safe_globals():
|
|||
# allow iterators and list comprehension
|
||||
out._getiter_ = iter
|
||||
out._iter_unpack_sequence_ = RestrictedPython.Guards.guarded_iter_unpack_sequence
|
||||
out._inplacevar_ = protected_inplacevar
|
||||
|
||||
# add common python builtins
|
||||
out.update(get_python_builtins())
|
||||
|
|
@ -729,6 +731,7 @@ WHITELISTED_SAFE_EVAL_GLOBALS = {
|
|||
"_getitem_": _getitem,
|
||||
"_getiter_": iter,
|
||||
"_iter_unpack_sequence_": RestrictedPython.Guards.guarded_iter_unpack_sequence,
|
||||
"_inplacevar_": protected_inplacevar,
|
||||
}
|
||||
|
||||
SAFE_ORJSON = NamespaceDict(loads=orjson.loads, dumps=orjson.dumps)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ dependencies = [
|
|||
"PyQRCode~=1.2.1",
|
||||
"PyYAML~=6.0.2",
|
||||
"RestrictedPython~=8.0",
|
||||
"AccessControl~=7.2",
|
||||
"WeasyPrint==59.0",
|
||||
"pydyf==0.11.0",
|
||||
"Werkzeug==3.1.3",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue