diff options
author | Jakob Lykke Andersen <jakobandersen@users.noreply.github.com> | 2021-04-18 17:02:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-18 17:02:59 +0200 |
commit | 9105635389e917804897e743fa639cbcbb394453 (patch) | |
tree | 9dba5683e648cf1569bf4285429c218d6fab3e86 | |
parent | 8ec937d4c965b0abd4c2c77d139a884455f907ae (diff) | |
parent | 025ec263f9f03c27f7ef2ade4b5b1d7a8f42fcac (diff) | |
download | sphinx-git-9105635389e917804897e743fa639cbcbb394453.tar.gz |
Merge pull request #9113 from jakobandersen/c_cpp_alias_fix
C, C++, alias fix
-rw-r--r-- | CHANGES | 3 | ||||
-rw-r--r-- | sphinx/domains/c.py | 3 | ||||
-rw-r--r-- | sphinx/domains/cpp.py | 3 |
3 files changed, 7 insertions, 2 deletions
@@ -24,6 +24,9 @@ Features added Bugs fixed ---------- +* C, C++, fix ``KeyError`` when an ``alias`` directive is the first C/C++ + directive in a file with another C/C++ directive later. + Testing -------- diff --git a/sphinx/domains/c.py b/sphinx/domains/c.py index 1eeaf65cf..b0711f68e 100644 --- a/sphinx/domains/c.py +++ b/sphinx/domains/c.py @@ -3454,7 +3454,8 @@ class AliasNode(nodes.Element): if 'c:parent_symbol' not in env.temp_data: root = env.domaindata['c']['root_symbol'] env.temp_data['c:parent_symbol'] = root - self.parentKey = env.temp_data['c:parent_symbol'].get_lookup_key() + env.ref_context['c:parent_key'] = root.get_lookup_key() + self.parentKey = env.ref_context['c:parent_key'] else: assert parentKey is not None self.parentKey = parentKey diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py index 4a36f6131..d57c6e257 100644 --- a/sphinx/domains/cpp.py +++ b/sphinx/domains/cpp.py @@ -7177,7 +7177,8 @@ class AliasNode(nodes.Element): if 'cpp:parent_symbol' not in env.temp_data: root = env.domaindata['cpp']['root_symbol'] env.temp_data['cpp:parent_symbol'] = root - self.parentKey = env.temp_data['cpp:parent_symbol'].get_lookup_key() + env.ref_context['cpp:parent_key'] = root.get_lookup_key() + self.parentKey = env.ref_context['cpp:parent_key'] else: assert parentKey is not None self.parentKey = parentKey |