Skip to content

Commit

Permalink
fix dump_module() bugs and rename parameter 'main' to 'module' (#526)
Browse files Browse the repository at this point in the history
* fix dump_module() bugs and rename parameter 'main' to 'module' (fixes #525)

New phrasing of mismatching modules error messages in load_session():

```python
>>> import dill
>>> dill.dump_module()
>>> dill.load_module(module='math')
ValueError: can't update module 'math' with the saved state of module '__main__'

>>> import types
>>> main = types.ModuleType('__main__')
>>> dill.load_module(module=main)
ValueError: can't update module-type object '__main__' with the saved state of imported module '__main__'

>>> dill.dump_module(module=main)
>>> dill.load_module(module='__main__')
ValueError: can't update imported module '__main__' with the saved state of module-type object '__main__'
```

* dump_module: clarify refimport description

* improvements to 'refimported' handling and extra checks in *_module() functions

* load_session(): clarify that the 'module' argument must match the session file's module
  • Loading branch information
leogama committed Jul 15, 2022
1 parent c23e049 commit 6b90f52
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -5,4 +5,4 @@
/docs/build
/build
/README
/dill/info.py
/dill/__info__.py

0 comments on commit 6b90f52

Please sign in to comment.