#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.
This commit is contained in:
Georg Brandl 2010-08-05 12:53:05 +02:00
parent eedef65aa6
commit 8c91fb78ce
4 changed files with 10 additions and 3 deletions

View File

@ -1,6 +1,8 @@
Release 1.0.2 (in development) 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 * #487: Fix setting the default role to one provided by the
``oldcmarkup`` extension. ``oldcmarkup`` extension.

View File

@ -142,9 +142,12 @@ class TypedField(GroupedField):
par += self.make_xref(self.rolename, domain, fieldarg, nodes.strong) par += self.make_xref(self.rolename, domain, fieldarg, nodes.strong)
if fieldarg in types: if fieldarg in types:
par += nodes.Text(' (') 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): 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) par += self.make_xref(self.typerolename, domain, typename)
else: else:
par += fieldtype par += fieldtype

View File

@ -62,6 +62,8 @@ Testing object descriptions
:ivar int hour: like *hour* :ivar int hour: like *hour*
:ivar minute: like *minute* :ivar minute: like *minute*
:vartype minute: int :vartype minute: int
:param hour: Duplicate param. Should not lead to crashes.
:type hour: Duplicate type.
C items C items

View File

@ -38,7 +38,7 @@ http://www.python.org/logo.png
reading included file u'wrongenc.inc' seems to be wrong, try giving an \ reading included file u'wrongenc.inc' seems to be wrong, try giving an \
:encoding: option\\n? :encoding: option\\n?
%(root)s/includes.txt:4: WARNING: download file not readable: nonexisting.png %(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 \ new-style markup \(e.g. c:function instead of cfunction\), see \
http://sphinx.pocoo.org/domains.html http://sphinx.pocoo.org/domains.html
""" """