diff options
| author | Georg Brandl <georg@python.org> | 2010-08-05 12:53:05 +0200 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2010-08-05 12:53:05 +0200 |
| commit | 50e8b6ac9e4bda6a1131fe34648259f0be807c0d (patch) | |
| tree | 1e857007ec6ed39ffe6b8ec9eb1f59e895eda575 /sphinx/util/docfields.py | |
| parent | 55710410d8c45135e57ed8d876e9ab44475b2d56 (diff) | |
| download | sphinx-50e8b6ac9e4bda6a1131fe34648259f0be807c0d.tar.gz | |
#484: Fix crash when duplicating a parameter in an info field list.
Problem was that the :type: info nodes were inserted twice into the
doctree, which led to inconsistencies when reference nodes were resolved.
Diffstat (limited to 'sphinx/util/docfields.py')
| -rw-r--r-- | sphinx/util/docfields.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sphinx/util/docfields.py b/sphinx/util/docfields.py index c8e58f48..6ce6d82b 100644 --- a/sphinx/util/docfields.py +++ b/sphinx/util/docfields.py @@ -142,9 +142,12 @@ class TypedField(GroupedField): par += self.make_xref(self.rolename, domain, fieldarg, nodes.strong) if fieldarg in types: par += nodes.Text(' (') - fieldtype = types[fieldarg] + # NOTE: using .pop() here to prevent a single type node to be + # inserted twice into the doctree, which leads to + # inconsistencies later when references are resolved + fieldtype = types.pop(fieldarg) if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text): - typename = u''.join(n.astext() for n in types[fieldarg]) + typename = u''.join(n.astext() for n in fieldtype) par += self.make_xref(self.typerolename, domain, typename) else: par += fieldtype |
