Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_sage_getargspec_cython fails to parse -Infinity #18192

Open
jdemeyer opened this issue Apr 14, 2015 · 2 comments
Open

_sage_getargspec_cython fails to parse -Infinity #18192

jdemeyer opened this issue Apr 14, 2015 · 2 comments

Comments

@jdemeyer
Copy link

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

@jdemeyer jdemeyer added this to the sage-6.6 milestone Apr 14, 2015
@jdemeyer
Copy link
Author

comment:1

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?

@jdemeyer
Copy link
Author

Stopgaps: #19100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants