-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-16077] [PYSPARK] catch the exception from pickle.whichmodule() #13788
Conversation
Test build #60877 has finished for PR 13788 at commit
|
cc @JoshRosen |
modname = pickle.whichmodule(obj, name) | ||
try: | ||
modname = pickle.whichmodule(obj, name) | ||
except Exception: |
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.
Is there a narrower exception that we can catch (ImportError
perhaps)?
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.
This will run into arbitary code, so anything could happen
Do you mind leaving a comment in the code referencing this issue / maybe linking to that |
Test build #61198 has finished for PR 13788 at commit
|
## What changes were proposed in this pull request? In the case that we don't know which module a object came from, will call pickle.whichmodule() to go throught all the loaded modules to find the object, which could fail because some modules, for example, six, see https://bitbucket.org/gutworth/six/issues/63/importing-six-breaks-pickling We should ignore the exception here, use `__main__` as the module name (it means we can't find the module). ## How was this patch tested? Manual tested. Can't have a unit test for this. Author: Davies Liu <davies@databricks.com> Closes #13788 from davies/whichmodule. (cherry picked from commit d489354) Signed-off-by: Davies Liu <davies.liu@gmail.com>
Merged into 1.6, 2.0 and master |
## What changes were proposed in this pull request? In the case that we don't know which module a object came from, will call pickle.whichmodule() to go throught all the loaded modules to find the object, which could fail because some modules, for example, six, see https://bitbucket.org/gutworth/six/issues/63/importing-six-breaks-pickling We should ignore the exception here, use `__main__` as the module name (it means we can't find the module). ## How was this patch tested? Manual tested. Can't have a unit test for this. Author: Davies Liu <davies@databricks.com> Closes #13788 from davies/whichmodule. (cherry picked from commit d489354) Signed-off-by: Davies Liu <davies.liu@gmail.com>
## What changes were proposed in this pull request? In the case that we don't know which module a object came from, will call pickle.whichmodule() to go throught all the loaded modules to find the object, which could fail because some modules, for example, six, see https://bitbucket.org/gutworth/six/issues/63/importing-six-breaks-pickling We should ignore the exception here, use `__main__` as the module name (it means we can't find the module). ## How was this patch tested? Manual tested. Can't have a unit test for this. Author: Davies Liu <davies@databricks.com> Closes apache#13788 from davies/whichmodule. (cherry picked from commit d489354) Signed-off-by: Davies Liu <davies.liu@gmail.com> (cherry picked from commit d7223bb)
What changes were proposed in this pull request?
In the case that we don't know which module a object came from, will call pickle.whichmodule() to go throught all the loaded modules to find the object, which could fail because some modules, for example, six, see https://bitbucket.org/gutworth/six/issues/63/importing-six-breaks-pickling
We should ignore the exception here, use
__main__
as the module name (it means we can't find the module).How was this patch tested?
Manual tested. Can't have a unit test for this.