Skip to content

Commit

Permalink
Close #7246: Drop special cross reference helper for exceptions, func…
Browse files Browse the repository at this point in the history
…tions and methods
  • Loading branch information
tk0miya committed Mar 7, 2020
1 parent 372813a commit 8e1934b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Expand Up @@ -32,6 +32,8 @@ Incompatible changes
to ``.. rst:role:: numref``
* #6903: py domain: Non intended behavior is removed such as ``say_hello_``
links to ``.. py:function:: say_hello()``
* #7246: py domain: Drop special cross reference helper for exceptions,
functions and methods

Deprecated
----------
Expand Down
8 changes: 0 additions & 8 deletions sphinx/domains/python.py
Expand Up @@ -1110,14 +1110,6 @@ def find_obj(self, env: BuildEnvironment, modname: str, classname: str,
elif modname and classname and \
modname + '.' + classname + '.' + name in self.objects:
newname = modname + '.' + classname + '.' + name
# special case: builtin exceptions have module "exceptions" set
elif type == 'exc' and '.' not in name and \
'exceptions.' + name in self.objects:
newname = 'exceptions.' + name
# special case: object methods
elif type in ('func', 'meth') and '.' not in name and \
'object.' + name in self.objects:
newname = 'object.' + name
if newname is not None:
matches.append((newname, self.objects[newname]))
return matches
Expand Down
12 changes: 0 additions & 12 deletions tests/test_domain_py.py
Expand Up @@ -206,18 +206,6 @@ def find_obj(modname, prefix, obj_name, obj_type, searchmode=0):
[('NestedParentA.NestedChildA.subchild_1',
('roles', 'nestedparenta-nestedchilda-subchild-1', 'method'))])

# special case: exceptions
assert (find_obj('exceptions', None, 'Exception', 'exc') ==
[('exceptions.Exception', ('module', 'exceptions-exception', 'exception'))])
assert (find_obj(None, None, 'Exception', 'exc') ==
[('exceptions.Exception', ('module', 'exceptions-exception', 'exception'))])

# special case: object
assert (find_obj('object', None, 'sum', 'func') ==
[('object.sum', ('module', 'object-sum', 'function'))])
assert (find_obj(None, None, 'sum', 'func') ==
[('object.sum', ('module', 'object-sum', 'function'))])


def test_get_full_qualified_name():
env = Mock(domaindata={})
Expand Down

0 comments on commit 8e1934b

Please sign in to comment.