sagemath/sage

Fix unpickle_global when register_unpickle_override appears in a module not loaded at startup

mkoeppe opened this issue · 9 comments

Calls of register_unpickle_override appear in various parts of the Sage library.

As we are modularizing the library -- and delaying the import of some modules -- we need to make sure that register_unpickle_override calls that appear in late-imported modules are respected.

This change allows us to remove some eager imports.

Depends on #32508

CC: @tscrim

Component: pickling

Author: Matthias Koeppe

Branch/Commit: 0496bda

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/32840

Commit: 0496bda

Author: Matthias Koeppe

New commits:

d7085dbMove package docstrings out of __init__.py
b7d2be9More refactoring of `__init__` files
ee4367dFixes for doctest failures
11e778aMerge #32508
10f0aaesrc/sage/combinat/root_system/__init__.py: Remove imports that ensured register_unpickle_override calls are run on startup
0496bdasage.misc.persist.unpickle_global: Check unpickle_override again after importing

Description changed:

--- 
+++ 
@@ -2,3 +2,5 @@
 
 As we are modularizing the library -- and delaying the import of some modules -- we need to make sure that `register_unpickle_override` calls that appear in late-imported modules are respected.
 
+This change allows us to remove some eager imports.
+
comment:3

Green bot => positive review.

Reviewer: Travis Scrimshaw

comment:4

Thank you! (The pyflakes warnings are not from this ticket.)