Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dynamic modules don't necessarily have a __package__ attribute
When trying to serialize some of the dynamically generated modules that pytest generates, errors like these are encountered. ``` File "/Users/mvanniekerk/miniconda3/envs/py36/lib/python3.6/pickle.py", line 476, in save f(self, obj) # Call unbound method with explicit self File "/Users/mvanniekerk/src/pytest-dask/.tox/py36/lib/python3.6/site-packages/cloudpickle/cloudpickle.py", line 366, in save_function self.save_function_tuple(obj) File "/Users/mvanniekerk/src/pytest-dask/.tox/py36/lib/python3.6/site-packages/cloudpickle/cloudpickle.py", line 494, in save_function_tuple itertools.chain(f_globals.values(), closure_values or ()), File "/Users/mvanniekerk/src/pytest-dask/.tox/py36/lib/python3.6/site-packages/cloudpickle/cloudpickle.py", line 388, in _save_subimports if isinstance(x, types.ModuleType) and x.__package__: File "/Users/mvanniekerk/src/pytest-dask/.tox/py36/lib/python3.6/site-packages/py/_apipkg.py", line 123, in __makeattr raise AttributeError(name) AttributeError: __package__ ``` After applying this change the resulting serialized objects work correctly
- Loading branch information