id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,merged,author,reviewer,upstream,work_issues,branch,commit,dependencies,stopgaps
27971,py3 failures in sage/misc/sageinspect.py and sagedoc.py,jhpalmieri,,"The Python 3 doctest failures in `sage/misc/sageinspect.py` and `sage/misc/sagedoc.py` all arise because of the second line here (from `sageinspect.py`):
{{{
spec = sage_getargspec(obj)
s = str(inspect.formatargspec(*spec))
}}}
The problem is that `inspect.formatargspec` is deprecated in Python 3.5, so it prints warning messages. From Sage's point of view, this is annoying, because there is no direct replacement (as far as I can tell) for `inspect.formatargspec`. The [https://docs.python.org/3/library/inspect.html#inspect.formatargspec documentation] says to use `signature` and `Signature`, but we have already obtained the signature information using `sage_getargspec` and just want to format it. Also, `inspect.signature` doesn't seem to work on Cython functions — see cython [https://github.com/cython/cython/issues/1864 issue 1864], or for a Sage-specific example:
{{{
sage: import inspect
sage: from sage.misc.sageinspect import sage_getargspec
sage: from sage.rings.integer import int_to_Z
sage: sage_getargspec(int_to_Z)
ArgSpec(args=['self', 'x'], varargs='args', keywords='kwds', defaults=None)
}}}
At this point, with Python 2:
{{{
sage: inspect.getargspec(long_to_Z)
...
TypeError: is not a Python function
}}}
With Python 3:
{{{
sage: inspect.signature(int_to_Z)
...
ValueError: no signature found for builtin type
}}}
Fixing this may also fix #27578.
",defect,closed,major,sage-8.9,python3,fixed,,,,John Palmieri,Vincent Klein,N/A,,bbd5b28fc8e451bea4f87c2f2b0c27586386262a,bbd5b28fc8e451bea4f87c2f2b0c27586386262a,,