Skip to content

Commit 0c4d1de

Browse files
committed
fix detection of functions for session saving
1 parent 23791f1 commit 0c4d1de

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/sage/misc/session.pyx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ from sage.misc.persist import load, save, loads, dumps
8080

8181
state_at_init = None
8282

83+
CythonFunctionType = type(lambda: None)
84+
8385
def init(state=None):
8486
"""
8587
Initialize some dictionaries needed by the :func:`show_identifiers`,
@@ -311,7 +313,7 @@ def save_session(name='sage_session', verbose=False):
311313
for k in show_identifiers(hidden = True):
312314
try:
313315
x = state[k]
314-
if isinstance(x, (types.FunctionType, types.BuiltinFunctionType, types.BuiltinMethodType, type)):
316+
if isinstance(x, (types.FunctionType, types.BuiltinFunctionType, types.BuiltinMethodType, CythonFunctionType, type)):
315317
raise TypeError('{} is a function, method, class or type'.format(k))
316318

317319
# We attempt to pickle *and* unpickle every variable to

0 commit comments

Comments
 (0)