Skip to content

Commit 216e16a

Browse files
authored
Merge branch '4.x' into 9456_abbr_marks_on_search_result
2 parents 1753012 + f590268 commit 216e16a

File tree

138 files changed

+24867
-2747
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+24867
-2747
lines changed

CHANGES

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ Bugs fixed
2121
----------
2222

2323
* #9487: autodoc: typehint for cached_property is not shown
24+
* #9481: autosummary: some warnings contain non-existing filenames
25+
* #9481: c domain: some warnings contain non-existing filenames
26+
* #9481: cpp domain: some warnings contain non-existing filenames
2427
* #9456: html search: abbreation marks are inserted to the search result if
2528
failed to fetch the content of the page
2629

2730
Testing
2831
--------
2932

30-
Release 4.1.2 (in development)
33+
Release 4.1.3 (in development)
3134
==============================
3235

3336
Dependencies
@@ -36,9 +39,6 @@ Dependencies
3639
Incompatible changes
3740
--------------------
3841

39-
* #9435: linkcheck: Disable checking automatically generated anchors on
40-
github.com (ex. anchors in reST/Markdown documents)
41-
4242
Deprecated
4343
----------
4444

@@ -48,15 +48,29 @@ Features added
4848
Bugs fixed
4949
----------
5050

51+
Testing
52+
--------
53+
54+
Release 4.1.2 (released Jul 27, 2021)
55+
=====================================
56+
57+
Incompatible changes
58+
--------------------
59+
60+
* #9435: linkcheck: Disable checking automatically generated anchors on
61+
github.com (ex. anchors in reST/Markdown documents)
62+
63+
Bugs fixed
64+
----------
65+
5166
* #9489: autodoc: Custom types using ``typing.NewType`` are not displayed well
5267
with the HEAD of 3.10
5368
* #9490: autodoc: Some objects under ``typing`` module are not displayed well
5469
with the HEAD of 3.10
70+
* #9436, #9471: autodoc: crashed if ``autodoc_class_signature = "separated"``
71+
* #9456: html search: html_copy_source can't control the search summaries
5572
* #9435: linkcheck: Failed to check anchors in github.com
5673

57-
Testing
58-
--------
59-
6074
Release 4.1.1 (released Jul 15, 2021)
6175
=====================================
6276

sphinx/domains/c.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3388,13 +3388,13 @@ def run(self) -> List[Node]:
33883388
stack: List[Symbol] = []
33893389
else:
33903390
parser = DefinitionParser(self.arguments[0],
3391-
location=self.get_source_info(),
3391+
location=self.get_location(),
33923392
config=self.env.config)
33933393
try:
33943394
name = parser.parse_namespace_object()
33953395
parser.assert_end()
33963396
except DefinitionError as e:
3397-
logger.warning(e, location=self.get_source_info())
3397+
logger.warning(e, location=self.get_location())
33983398
name = _make_phony_error_name()
33993399
symbol = rootSymbol.add_name(name)
34003400
stack = [symbol]
@@ -3415,13 +3415,13 @@ def run(self) -> List[Node]:
34153415
if self.arguments[0].strip() in ('NULL', '0', 'nullptr'):
34163416
return []
34173417
parser = DefinitionParser(self.arguments[0],
3418-
location=self.get_source_info(),
3418+
location=self.get_location(),
34193419
config=self.env.config)
34203420
try:
34213421
name = parser.parse_namespace_object()
34223422
parser.assert_end()
34233423
except DefinitionError as e:
3424-
logger.warning(e, location=self.get_source_info())
3424+
logger.warning(e, location=self.get_location())
34253425
name = _make_phony_error_name()
34263426
oldParent = self.env.temp_data.get('c:parent_symbol', None)
34273427
if not oldParent:
@@ -3446,7 +3446,7 @@ def run(self) -> List[Node]:
34463446
stack = self.env.temp_data.get('c:namespace_stack', None)
34473447
if not stack or len(stack) == 0:
34483448
logger.warning("C namespace pop on empty stack. Defaulting to gobal scope.",
3449-
location=self.get_source_info())
3449+
location=self.get_location())
34503450
stack = []
34513451
else:
34523452
stack.pop()
@@ -3628,7 +3628,7 @@ def run(self) -> List[Node]:
36283628
" Requested 'noroot' but 'maxdepth' 1."
36293629
" When skipping the root declaration,"
36303630
" need 'maxdepth' 0 for infinite or at least 2.",
3631-
location=self.get_source_info())
3631+
location=self.get_location())
36323632
signatures = self.get_signatures()
36333633
for i, sig in enumerate(signatures):
36343634
node.append(AliasNode(sig, aliasOptions, self.state.document, env=self.env))
@@ -3661,7 +3661,7 @@ def run(self) -> Tuple[List[Node], List[system_message]]:
36613661
return super().run()
36623662

36633663
text = self.text.replace('\n', ' ')
3664-
parser = DefinitionParser(text, location=self.get_source_info(),
3664+
parser = DefinitionParser(text, location=self.get_location(),
36653665
config=self.env.config)
36663666
try:
36673667
parser.parse_xref_object()
@@ -3686,7 +3686,7 @@ def run(self) -> Tuple[List[Node], List[system_message]]:
36863686
msg = "{}: Pre-v3 C type role ':c:type:`{}`' converted to ':c:expr:`{}`'."
36873687
msg += "\nThe original parsing error was:\n{}"
36883688
msg = msg.format(RemovedInSphinx50Warning.__name__, text, text, eOrig)
3689-
logger.warning(msg, location=self.get_source_info())
3689+
logger.warning(msg, location=self.get_location())
36903690
return [signode], []
36913691

36923692

@@ -3702,14 +3702,14 @@ def __init__(self, asCode: bool) -> None:
37023702

37033703
def run(self) -> Tuple[List[Node], List[system_message]]:
37043704
text = self.text.replace('\n', ' ')
3705-
parser = DefinitionParser(text, location=self.get_source_info(),
3705+
parser = DefinitionParser(text, location=self.get_location(),
37063706
config=self.env.config)
37073707
# attempt to mimic XRefRole classes, except that...
37083708
try:
37093709
ast = parser.parse_expression()
37103710
except DefinitionError as ex:
37113711
logger.warning('Unparseable C expression: %r\n%s', text, ex,
3712-
location=self.get_source_info())
3712+
location=self.get_location())
37133713
# see below
37143714
return [addnodes.desc_inline('c', text, text, classes=[self.class_type])], []
37153715
parentSymbol = self.env.temp_data.get('c:parent_symbol', None)

sphinx/domains/cpp.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7005,7 +7005,7 @@ def add_target_and_index(self, ast: ASTDeclaration, sig: str,
70057005
if not re.compile(r'^[a-zA-Z0-9_]*$').match(newestId):
70067006
logger.warning('Index id generation for C++ object "%s" failed, please '
70077007
'report as bug (id=%s).', ast, newestId,
7008-
location=self.get_source_info())
7008+
location=self.get_location())
70097009

70107010
name = ast.symbol.get_full_nested_name().get_display_string().lstrip(':')
70117011
# Add index entry, but not if it's a declaration inside a concept
@@ -7088,7 +7088,7 @@ def run(self) -> List[Node]:
70887088
logger.warning(msg.format(
70897089
str(parentSymbol.get_full_nested_name()),
70907090
self.name, self.arguments[0]
7091-
), location=self.get_source_info())
7091+
), location=self.get_location())
70927092
name = _make_phony_error_name()
70937093
symbol = parentSymbol.add_name(name)
70947094
env.temp_data['cpp:last_symbol'] = symbol
@@ -7216,13 +7216,13 @@ def run(self) -> List[Node]:
72167216
stack: List[Symbol] = []
72177217
else:
72187218
parser = DefinitionParser(self.arguments[0],
7219-
location=self.get_source_info(),
7219+
location=self.get_location(),
72207220
config=self.config)
72217221
try:
72227222
ast = parser.parse_namespace_object()
72237223
parser.assert_end()
72247224
except DefinitionError as e:
7225-
logger.warning(e, location=self.get_source_info())
7225+
logger.warning(e, location=self.get_location())
72267226
name = _make_phony_error_name()
72277227
ast = ASTNamespace(name, None)
72287228
symbol = rootSymbol.add_name(ast.nestedName, ast.templatePrefix)
@@ -7244,13 +7244,13 @@ def run(self) -> List[Node]:
72447244
if self.arguments[0].strip() in ('NULL', '0', 'nullptr'):
72457245
return []
72467246
parser = DefinitionParser(self.arguments[0],
7247-
location=self.get_source_info(),
7247+
location=self.get_location(),
72487248
config=self.config)
72497249
try:
72507250
ast = parser.parse_namespace_object()
72517251
parser.assert_end()
72527252
except DefinitionError as e:
7253-
logger.warning(e, location=self.get_source_info())
7253+
logger.warning(e, location=self.get_location())
72547254
name = _make_phony_error_name()
72557255
ast = ASTNamespace(name, None)
72567256
oldParent = self.env.temp_data.get('cpp:parent_symbol', None)
@@ -7276,7 +7276,7 @@ def run(self) -> List[Node]:
72767276
stack = self.env.temp_data.get('cpp:namespace_stack', None)
72777277
if not stack or len(stack) == 0:
72787278
logger.warning("C++ namespace pop on empty stack. Defaulting to gobal scope.",
7279-
location=self.get_source_info())
7279+
location=self.get_location())
72807280
stack = []
72817281
else:
72827282
stack.pop()
@@ -7480,7 +7480,7 @@ def run(self) -> List[Node]:
74807480
" Requested 'noroot' but 'maxdepth' 1."
74817481
" When skipping the root declaration,"
74827482
" need 'maxdepth' 0 for infinite or at least 2.",
7483-
location=self.get_source_info())
7483+
location=self.get_location())
74847484
signatures = self.get_signatures()
74857485
for i, sig in enumerate(signatures):
74867486
node.append(AliasNode(sig, aliasOptions, env=self.env))
@@ -7537,14 +7537,14 @@ def __init__(self, asCode: bool) -> None:
75377537
def run(self) -> Tuple[List[Node], List[system_message]]:
75387538
text = self.text.replace('\n', ' ')
75397539
parser = DefinitionParser(text,
7540-
location=self.get_source_info(),
7540+
location=self.get_location(),
75417541
config=self.config)
75427542
# attempt to mimic XRefRole classes, except that...
75437543
try:
75447544
ast = parser.parse_expression()
75457545
except DefinitionError as ex:
75467546
logger.warning('Unparseable C++ expression: %r\n%s', text, ex,
7547-
location=self.get_source_info())
7547+
location=self.get_location())
75487548
# see below
75497549
return [addnodes.desc_inline('cpp', text, text, classes=[self.class_type])], []
75507550
parentSymbol = self.env.temp_data.get('cpp:parent_symbol', None)

sphinx/ext/autodoc/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ def process(app: Sphinx, what_: str, name: str, obj: Any, options: Any, lines: L
257257
# But we define this class here to keep compatibility (see #4538)
258258
class Options(dict):
259259
"""A dict/attribute hybrid that returns None on nonexisting keys."""
260+
def copy(self) -> "Options":
261+
return Options(super().copy())
262+
260263
def __getattr__(self, name: str) -> Any:
261264
try:
262265
return self[name.replace('_', '-')]
@@ -1445,9 +1448,11 @@ def __init__(self, *args: Any) -> None:
14451448
super().__init__(*args)
14461449

14471450
if self.config.autodoc_class_signature == 'separated':
1451+
self.options = self.options.copy()
1452+
14481453
# show __init__() method
14491454
if self.options.special_members is None:
1450-
self.options['special-members'] = {'__new__', '__init__'}
1455+
self.options['special-members'] = ['__new__', '__init__']
14511456
else:
14521457
self.options.special_members.append('__new__')
14531458
self.options.special_members.append('__init__')

sphinx/ext/autosummary/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def run(self) -> List[Node]:
280280
msg = __('autosummary: stub file not found %r. '
281281
'Check your autosummary_generate setting.')
282282

283-
logger.warning(msg, real_name, location=self.get_source_info())
283+
logger.warning(msg, real_name, location=self.get_location())
284284
continue
285285

286286
docnames.append(docname)
@@ -344,7 +344,7 @@ def get_items(self, names: List[str]) -> List[Tuple[str, str, str, str]]:
344344
real_name, obj, parent, modname = self.import_by_name(name, prefixes=prefixes)
345345
except ImportError:
346346
logger.warning(__('autosummary: failed to import %s'), name,
347-
location=self.get_source_info())
347+
location=self.get_location())
348348
continue
349349

350350
self.bridge.result = StringList() # initialize for each documenter
@@ -358,12 +358,12 @@ def get_items(self, names: List[str]) -> List[Tuple[str, str, str, str]]:
358358
documenter = self.create_documenter(self.env.app, obj, parent, full_name)
359359
if not documenter.parse_name():
360360
logger.warning(__('failed to parse name %s'), real_name,
361-
location=self.get_source_info())
361+
location=self.get_location())
362362
items.append((display_name, '', '', real_name))
363363
continue
364364
if not documenter.import_object():
365365
logger.warning(__('failed to import object %s'), real_name,
366-
location=self.get_source_info())
366+
location=self.get_location())
367367
items.append((display_name, '', '', real_name))
368368
continue
369369
if documenter.options.members and not documenter.check_module():
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)