Open jdemeyer opened 9 years ago
sage: from sage.misc.sageinspect import _sage_getargspec_cython sage: _sage_getargspec_cython("def foo(x=-Infinity):\n pass") --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-20-70637b2db91d> in <module>() ----> 1 _sage_getargspec_cython("def foo(x=-Infinity):\n pass") /usr/local/src/sage-git/local/lib/python2.7/site-packages/sage/misc/sageinspect.pyc in _sage_getargspec_cython(source) 1121 keywords = '**'+keywords 1122 return _sage_getargspec_from_ast('def dummy('+''.join(py_units) -> 1123 +varargs+keywords+'): pass') 1124 1125 def sage_getfile(obj): /usr/local/src/sage-git/local/lib/python2.7/site-packages/sage/misc/sageinspect.pyc in _sage_getargspec_from_ast(source) 913 visitor = SageArgSpecVisitor() 914 args = [visitor.visit(a) for a in ast_args.args] --> 915 defaults = [visitor.visit(d) for d in ast_args.defaults] 916 917 return inspect.ArgSpec(args, ast_args.vararg, ast_args.kwarg, /usr/local/src/sage-git/local/lib/python/ast.pyc in visit(self, node) 239 method = 'visit_' + node.__class__.__name__ 240 visitor = getattr(self, method, self.generic_visit) --> 241 return visitor(node) 242 243 def generic_visit(self, node): /usr/local/src/sage-git/local/lib/python2.7/site-packages/sage/misc/sageinspect.pyc in visit_UnaryOp(self, node) 679 return self.visit(node.operand) 680 if op == 'USub': --> 681 return -self.visit(node.operand) 682 683 def _grep_first_pair_of_parentheses(s): TypeError: bad operand type for unary -: 'str'
CC: @simon-king-jena
Component: documentation
Stopgaps: #19100
Issue created by migration from https://trac.sagemath.org/ticket/18192
Any clue what to do with this? Ideally, we should just get the complete argument as a string (say, a default argument which is 2*(Infinity+1)). Is there a way to do this?
2*(Infinity+1)
CC: @simon-king-jena
Component: documentation
Stopgaps: #19100
Issue created by migration from https://trac.sagemath.org/ticket/18192