-
-
Couldn't load subscription status.
- Fork 680
Open
Description
This function is problematic when sage.all is not available (in modularized subset distributions):
def lookup_global(name):
"""
Used in unpickling the factory itself.
EXAMPLES::
sage: from sage.structure.factory import lookup_global
sage: lookup_global('ZZ')
Integer Ring
sage: lookup_global('sage.rings.all.ZZ')
Integer Ring
"""
name = bytes_to_str(name, encoding='ASCII')
try:
return factory_unpickles[name]
except KeyError:
pass
if '.' in name:
module, name = name.rsplit('.', 1)
all = __import__(module, fromlist=[name])
else:
import sage.all as all
return getattr(all, name)
CC: @kliem
Component: pickling
Issue created by migration from https://trac.sagemath.org/ticket/32586