Inheritance-diagram generation fails when a class is derived from collections.namedtuple

Anonymous avatarAnonymous created an issue

Autodoc on the following short program fails when built with 1.0.1. Removing the inheritance-diagram directive makes the failure go away.

r"""                                                                                                                                                        
MyModule docstring starts here                                                                                                                            
.. inheritance-diagram:: mymod                                                                                                                         
"""
import collections
class Foo(collections.namedtuple('Foo_tuple_name', 'bar baz')):
    """                                                                                                                                                     
    A specialization of namedtuple with three attributes.                                                                                                   
    """
    pass

Here's the error message:

Exception occurred:
  File "/usr/lib/python2.6/site-packages/sphinx/environment.py", line 703, in read_doc
    pickle.dump(doctree, f, pickle.HIGHEST_PROTOCOL)
PicklingError: Can't pickle <class 'pkg1.mymod.Foo_tuple_name'>: attribute lookup pkg1.mymod.Foo_tuple_name failed
The full traceback has been saved in /tmp/sphinx-err-96a0zi.log, if you want to report the issue to the developers.

Here's the full traceback:

# Sphinx version: 1.0.1
# Docutils version: 0.6 release
# Jinja2 version: 2.2.1
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/sphinx/cmdline.py", line 173, in main
    app.build(force_all, filenames)
  File "/usr/lib/python2.6/site-packages/sphinx/application.py", line 207, in build
    self.builder.build_update()
  File "/usr/lib/python2.6/site-packages/sphinx/builders/__init__.py", line 198, in build_update
    'out of date' % len(to_build))
  File "/usr/lib/python2.6/site-packages/sphinx/builders/__init__.py", line 218, in build
    purple, length):
  File "/usr/lib/python2.6/site-packages/sphinx/builders/__init__.py", line 120, in status_iterator
    for item in iterable:
  File "/usr/lib/python2.6/site-packages/sphinx/environment.py", line 515, in update_generator
    self.read_doc(docname, app=app)
  File "/usr/lib/python2.6/site-packages/sphinx/environment.py", line 703, in read_doc
    pickle.dump(doctree, f, pickle.HIGHEST_PROTOCOL)
PicklingError: Can't pickle <class 'pkg1.mymod.Foo_tuple_name'>: attribute lookup pkg1.mymod.Foo_tuple_name failed

Comments (1)

  1. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.