summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--sphinx/util/docfields.py7
-rw-r--r--tests/root/objects.txt2
-rw-r--r--tests/test_build_html.py2
4 files changed, 10 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index bc122e9c..f9b3b9a4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
Release 1.0.2 (in development)
==============================
+* #484: Fix crash when duplicating a parameter in an info field list.
+
* #487: Fix setting the default role to one provided by the
``oldcmarkup`` extension.
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
diff --git a/tests/root/objects.txt b/tests/root/objects.txt
index 334827de..d6b8bdf6 100644
--- a/tests/root/objects.txt
+++ b/tests/root/objects.txt
@@ -62,6 +62,8 @@ Testing object descriptions
:ivar int hour: like *hour*
:ivar minute: like *minute*
:vartype minute: int
+ :param hour: Duplicate param. Should not lead to crashes.
+ :type hour: Duplicate type.
C items
diff --git a/tests/test_build_html.py b/tests/test_build_html.py
index 4dee513a..813c962f 100644
--- a/tests/test_build_html.py
+++ b/tests/test_build_html.py
@@ -38,7 +38,7 @@ http://www.python.org/logo.png
reading included file u'wrongenc.inc' seems to be wrong, try giving an \
:encoding: option\\n?
%(root)s/includes.txt:4: WARNING: download file not readable: nonexisting.png
-%(root)s/objects.txt:84: WARNING: using old C markup; please migrate to \
+%(root)s/objects.txt:86: WARNING: using old C markup; please migrate to \
new-style markup \(e.g. c:function instead of cfunction\), see \
http://sphinx.pocoo.org/domains.html
"""