You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi! i'm sorry if this isn't the right place to ask this question, but i couldn't find anywhere else that the cool RestrictedPython people hang out.
i'm using a python package that is basically a domain-specific language, and one of the features of the language is overwriting @ to have a specific definition.
after failing repeatedly to do a workaround where i overwrite @ with AST before getting the safe code, i think i need to find a way to allow ___matmult___ (or more accurately, allow the @ to be in the code)
what would be the recommended way to do this?
the simplest way i can think of is to fork the repo & change this line to allow the node to be visited.
for both safety and maintainability, i would prefer to avoid changing the source code if possible.
is there a more elegant way to tell restrictedpython that it needs to allow @ ? can i add a @ function to the safe_globals that just passes the symbol through?
to clarify once again - i don't need ___matmult___, i need restrictedpython to allow the @ so i can use the package-specific definition of the @ symbol.
The text was updated successfully, but these errors were encountered:
@rawwerks You could create a PR where visit_MatMult calls return self.node_contents_visit(node) like the other binary operators.
It is currently not allowed, because there was no use-case, yet, and we were not able to come up with example code for the tests: There seems to be no usage in plain Python.
hi! i'm sorry if this isn't the right place to ask this question, but i couldn't find anywhere else that the cool RestrictedPython people hang out.
i'm using a python package that is basically a domain-specific language, and one of the features of the language is overwriting
@
to have a specific definition.after failing repeatedly to do a workaround where i overwrite
@
with AST before getting the safe code, i think i need to find a way to allow___matmult___
(or more accurately, allow the@
to be in the code)what would be the recommended way to do this?
the simplest way i can think of is to fork the repo & change this line to allow the node to be visited.
RestrictedPython/src/RestrictedPython/transformer.py
Line 770 in 821ea97
for both safety and maintainability, i would prefer to avoid changing the source code if possible.
is there a more elegant way to tell restrictedpython that it needs to allow
@
? can i add a@
function to the safe_globals that just passes the symbol through?to clarify once again - i don't need
___matmult___
, i need restrictedpython to allow the@
so i can use the package-specific definition of the@
symbol.The text was updated successfully, but these errors were encountered: