Augmented assignment of object items and slices is not allowed.
## BUG/PROBLEM REPORT / FEATURE REQUEST
When I run:
```
a = [1, 2, 3]
a[0] += 1
print(a)
```
Error: **Augmented assignment of object items and slices is not allowed.**
After my investigation, the issue seems to be in the:
_RestrictedPython\transformer.py --> class RestrictingNodeTransformer --> def visit_AugAssign:_
```
elif isinstance(node.target, ast.Subscript):
self.error(
node,
"Augmented assignment of object items "
"and slices is not allowed.")
return node
```
I don't understand why operations like **a[0] += 1** have security risks, and RestrictedPython restricts this behavior.
I can only bypass the detection by: **a[0] = a[0] + 1**, or by modifying the source code of RestrictedPython.
I hope that future versions of RestrictedPython will support this.
0 条评论