summaryrefslogtreecommitdiff
path: root/sphinx/domains/python.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/domains/python.py')
-rw-r--r--sphinx/domains/python.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py
index 73f0440e..e812b610 100644
--- a/sphinx/domains/python.py
+++ b/sphinx/domains/python.py
@@ -212,13 +212,12 @@ class PyObject(ObjectDescription):
self.state.document.note_explicit_target(signode)
objects = self.env.domaindata['py']['objects']
if fullname in objects:
- self.env.warn(
- self.env.docname,
+ self.state_machine.reporter.warning(
'duplicate object description of %s, ' % fullname +
'other instance in ' +
self.env.doc2path(objects[fullname][0]) +
', use :noindex: for one of them',
- self.lineno)
+ line=self.lineno)
objects[fullname] = (self.env.docname, self.objtype)
indextext = self.get_index_text(modname, name_cls)
@@ -648,11 +647,10 @@ class PythonDomain(Domain):
if not matches:
return None
elif len(matches) > 1:
- env.warn(fromdocname,
- 'more than one target found for cross-reference '
- '%r: %s' % (target,
- ', '.join(match[0] for match in matches)),
- node.line)
+ env.warn_node(
+ 'more than one target found for cross-reference '
+ '%r: %s' % (target, ', '.join(match[0] for match in matches)),
+ node)
name, obj = matches[0]
if obj[1] == 'module':