#16181: inject_shorthands broken since 6.2beta8
-------------------------------------+-------------------------------------
Reporter: darij | Owner:
Type: defect | Status: new
Priority: critical | Milestone: sage-6.2
Component: misc | Keywords: globals,
Merged in: | inject_shorthands, regression,
Reviewers: | Authors:
Work issues: | Report Upstream: N/A
Commit: | Branch:
67855fc66eed143172a9065928e52241d97edefe| public/combinat/inject_shorthands
Stopgaps: | Dependencies:
-------------------------------------+-------------------------------------
{{{
sage: NSym = NonCommutativeSymmetricFunctions(QQ)
sage: NSym.inject_shorthands()
Injecting S as shorthand for Non-Commutative Symmetric Functions over the
Rational Field in the Complete basis
---------------------------------------------------------------------------
KeyError Traceback (most recent call
last)
<ipython-input-2-458277a04544> in <module>()
----> 1 NSym.inject_shorthands()
/home/darij/gitsage6.2/local/lib/python2.7/site-
packages/sage/categories/sets_cat.pyc in inject_shorthands(self, verbose)
1318 if verbose:
1319 print 'Injecting %s as shorthand for
%s'%(shorthand, realization)
-> 1320 inject_variable(shorthand, realization)
1321
1322 def realizations(self):
/home/darij/gitsage6.2/local/lib/python2.7/site-
packages/sage/misc/misc.pyc in inject_variable(name, value)
2356 # inject_variable is called not only from the interpreter, but
2357 # also from functions in various modules.
-> 2358 G = get_main_globals()
2359 if name in G:
2360 warn("redefining global value `%s`"%name, RuntimeWarning,
stacklevel = 2)
/home/darij/gitsage6.2/local/lib/python2.7/site-
packages/sage/misc/misc.pyc in get_main_globals()
2312 while True:
2313 G = sys._getframe(depth).f_globals
-> 2314 if G["__name__"] == "__main__" and G["__package__"] is
None:
2315 break
2316 depth += 1
KeyError: '__package__'
}}}
Same for Sym and QSym.
The `get_main_globals` method hasn't been changed since 2011, so I suspect
something else is at fault. The attached branch gets rid of the bug, but I
don't understand the code at hand and so it is not really merge-ready.
Needs_review is to increase visibility.
--
Ticket URL: <http://trac.sagemath.org/ticket/16181>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.