Fixed crashed in _dill._is_builtin_module when a module's __file__ is None#598
Conversation
|
@miguelinux314: Thanks for catching this. In theory, |
|
Thank you @mmckerns for the quick reply. Yes, the On the other hand, under certain conditions (see https://github.com/python/cpython/blob/423459be2f0b6d007e5f235f39d80044cb099faf/Lib/importlib/_bootstrap.py#L667, caused by https://bugs.python.org/issue32305) Based on this, I don't think one can get the Thanks again for you time and help |
|
I'll take it as is. thanks |
Summary
The
_is_builtin_modulefunction ofdill/_dill.pyhas the following check in line 1587if not hasattr(module, "__file__"): return TrueIf the check is not passed, then
os.path.realpath(module.__file__)is called later in that function (line 1591).This causes dill to crash when a module has
__file__set toNone. This PR fixes that check so that whenmodule.__file__ is None, the module is recognized as not builtin.Notes:
__file__is set it is a string, it will actually be none when importing a module without an__init__.pyfile in it.