-
-
Notifications
You must be signed in to change notification settings - Fork 181
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
Fixes some bugs when using dump_session()
with byref=True
#463
Commits on Apr 22, 2022
-
fix
dump_session(byref=True)
bug when no objetcts are imported from…… modules When no objects are found to be imported from external modules, `_stash_modules()` should return `main_module` unmodified, and not the pair list of objects created from it (`original`).
Configuration menu - View commit details
-
Copy full SHA for b98cd44 - Browse repository at this point
Copy the full SHA b98cd44View commit details -
fix
dump_session(byref=True)
bug when themultiprocessing
module ……was imported Just calling `import multiprocessing` creates a `'__mp_main__'` entry in `sys.modules` that is simply a reference to the `__main__` module. In the old version of the test for module membership, objects in the global scope are wrongly attributed to this virtual `__mp_main__` module. And therefore `load_session()` fails. Testing for object identity instead of module name resolves the issue.
Configuration menu - View commit details
-
Copy full SHA for 44a9e54 - Browse repository at this point
Copy the full SHA 44a9e54View commit details
Commits on Apr 25, 2022
-
Save objects imported with an alias and top level modules by referenc…
…e in `dump_session(byref=TRUE)` Currently, `dump_session(byref=True)` misses some imported objects. For example: - If the session had a statement `import numpy as np`, it may find a reference to the `numpy` named as `np` in some internal module listed in `sys.resources`. But if the module was imported with a non-canonical name, like `import numpy as nump`, it won't find it at all. Mapping the objects by id in `modmap` solves the issue. Note that just types of objects usually imported under an alias must be looked up by id, otherwise common objects like singletons may be wrongly attributed to a module, and such reference in the module could change to a different object depending on its initialization and state. - If a object in the global scope is a top level module, like `math`, again `save_session` may find a reference to it in another module and it works. But if this module isn't referenced anywhere else, it won't be found because the function only looks for objects inside the `sys.resources` modules and not for the modules themselves. This commit introduces two new attributes to session modules saved by reference: - `__dill_imported_as`: a list with (module name, object name, object alias in session) - `__dill_imported_top_level`: a list with (module name, module alias in session) I did it this way for forwards (complete) and backwards (partial) compatibility. Oh, and I got rid of that nasty `exec()` call in `_restore_modules()`! ;)
Configuration menu - View commit details
-
Copy full SHA for a252e44 - Browse repository at this point
Copy the full SHA a252e44View commit details
Commits on Apr 26, 2022
-
Deal with top level functions with
dump_session()
Fixes RecursionWarning error where a function defined in the top level of the module being saved with `dump_session(byref=True)`, of which "globals" is a reference to the original module's `__dict__`, makes dill to try to save this instead of the modified module's `__dict__`, triggering recursion.
Configuration menu - View commit details
-
Copy full SHA for 8b15b99 - Browse repository at this point
Copy the full SHA 8b15b99View commit details
Commits on Apr 28, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 47a060d - Browse repository at this point
Copy the full SHA 47a060dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6156dc5 - Browse repository at this point
Copy the full SHA 6156dc5View commit details
Commits on Apr 29, 2022
-
Configuration menu - View commit details
-
Copy full SHA for bf419f1 - Browse repository at this point
Copy the full SHA bf419f1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1aef037 - Browse repository at this point
Copy the full SHA 1aef037View commit details
Commits on Apr 30, 2022
-
Configuration menu - View commit details
-
Copy full SHA for abdfd5c - Browse repository at this point
Copy the full SHA abdfd5cView commit details -
Configuration menu - View commit details
-
Copy full SHA for a87496b - Browse repository at this point
Copy the full SHA a87496bView commit details -
Configuration menu - View commit details
-
Copy full SHA for e4ba1e8 - Browse repository at this point
Copy the full SHA e4ba1e8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 095b4cb - Browse repository at this point
Copy the full SHA 095b4cbView commit details -
Configuration menu - View commit details
-
Copy full SHA for d1450bf - Browse repository at this point
Copy the full SHA d1450bfView commit details -
Configuration menu - View commit details
-
Copy full SHA for f292584 - Browse repository at this point
Copy the full SHA f292584View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5b90579 - Browse repository at this point
Copy the full SHA 5b90579View commit details -
dump_session() tests: merge test files using subprocess to test loadi…
…ng in a new session
Configuration menu - View commit details
-
Copy full SHA for 1f310a9 - Browse repository at this point
Copy the full SHA 1f310a9View commit details
Commits on May 1, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 3ae5f1a - Browse repository at this point
Copy the full SHA 3ae5f1aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0c1b1d1 - Browse repository at this point
Copy the full SHA 0c1b1d1View commit details