Allow unsafe custom __getitem__ executions when allow unsafe executions is on

This commit is contained in:
Dave Halter committed 2023-07-29 00:33:09 +02:00
1 parent 8a4b079d0f
commit 57aefed6ea
3 files changed
+25 -5

No files matched your search

+2 -2
View File
@@ -230,8 +230,8 @@ class DirectObjectAccess:
return [annotation]
return None
def py__simple_getitem__(self, index):
if type(self._obj) not in ALLOWED_GETITEM_TYPES:
def py__simple_getitem__(self, index, *, safe=True):
if safe and type(self._obj) not in ALLOWED_GETITEM_TYPES:
# Get rid of side effects, we won't call custom `__getitem__`s.
return None