In SageMath 9.0, I have got an AttributeError when generating a ReST table 
of methods of a class with a classmethod using `gen_rest_table_index`:

sage: class foo(SageObject):
....:     @classmethod
....:     def bar(cls):
....:         pass
....:      
sage: gen_rest_table_index(foo)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-13-292c8c0bbbb0> in <module>()
----> 1 gen_rest_table_index(foo)

/zvol/sage/sage-9.0/x86_64/local/lib/python3.7/site-packages/sage/misc/
rest_index_of_methods.py in gen_rest_table_index(obj, names, sort, 
only_local_functions)
    174         if inspect.ismethod(e):
    175             link = ":meth:`~{module}.{cls}.{func}`".format(
--> 176                 module=e.im_class.__module__, cls=e.im_class.
__name__,
    177                 func=fname(e))
    178         elif not PY2 and inspect.isfunction(e) and inspect.isclass(
obj):

AttributeError: 'function' object has no attribute 'im_class'

It works fine if there is no classmethod:

sage: class foo2(SageObject):
....:     def bar(self):
....:         pass
....:      
sage: gen_rest_table_index(foo2)
'.. csv-table::\n   :class: contentstable\n   :widths: 30, 70\n   :delim: 
@\n\n   :meth:`~__main__.foo2.bar` @ NO DOCSTRING\n'

I guess the problem is that `im_class` is not available in Python 3, am I 
right?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/81be5a04-5483-48bf-bc71-0fd9895faa44%40googlegroups.com.

Reply via email to