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
fix: can not run in Python repl #139
Conversation
@@ -268,9 +268,21 @@ def create_in_db(self, db: Database) -> None: | |||
for param in func_sig.parameters.values() | |||
] | |||
) | |||
# make inspect.getsource can run in Python REPL(IPython do not have this issue) | |||
# CPython issue https://github.com/python/cpython/issues/57129 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some thoughts after leaning this magical library:
# CPython issue https://github.com/python/cpython/issues/57129 | |
# CPython issue https://github.com/python/cpython/issues/57129 | |
# TODO: in the future, we might want to use `dill.dumps(func, recurse=True)` | |
# to send the function to the DBMS with dependencies like imports. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that will be wonderful we will use this library more not only the getsource
things
greenplumpython/func.py
Outdated
# CPython issue https://github.com/python/cpython/issues/57129 | ||
try: | ||
source: str = inspect.getsource(self._wrapped_func) | ||
# if run inspect.getsource(func) in REPL will rasie IOError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# if run inspect.getsource(func) in REPL will rasie IOError | |
# if run inspect.getsource(func) in REPL will raise IOError |
this pr fix can not run greenplumpython in python repl
see issue python/cpython#57129