Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid serializing functions #467

Open
odashi opened this issue Sep 10, 2022 · 3 comments
Open

Avoid serializing functions #467

odashi opened this issue Sep 10, 2022 · 3 comments

Comments

@odashi
Copy link
Contributor

odashi commented Sep 10, 2022

Current serialization attempt to serialize functions via inspect.getsource:

elif callable(data):
return getsource(data)

However, this function supports only limited cases: given callables have to be represented as a substantial source, and builtin/synthesized functions can't be supported. Basically we don't have complete way to serialize functions.

In addition, storing runnable code to loadable data is dangerous because it opens a door to attack the system. If we don't have any special demands, it is better to avoid this functionality from the codebase.

RFC: @neubig

@neubig
Copy link
Contributor

neubig commented Sep 10, 2022

I think that's fine. This serialization was more for reference, and I never intended the code to be deserialized and used.

@odashi
Copy link
Contributor Author

odashi commented Sep 10, 2022

Is there no utilization of this feature? If so we can just remove this.

@neubig
Copy link
Contributor

neubig commented Oct 10, 2022

Yeah, I think it can be removed for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants