diff --git a/CHANGES b/CHANGES index c3bd34357..5cd04b793 100644 --- a/CHANGES +++ b/CHANGES @@ -32,6 +32,10 @@ Release 1.1 (in development) Release 1.0.6 (in development) ============================== +* Fix strange reportings of line numbers for warnings generated from + autodoc-included docstrings, due to different behavior depending + on docutils version. + * Several fixes to the C++ domain. diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py index ffa76f4eb..901b96f49 100644 --- a/sphinx/domains/cpp.py +++ b/sphinx/domains/cpp.py @@ -448,9 +448,9 @@ class DefinitionParser(object): 'mutable': None, 'const': None, 'typename': None, - 'unsigned': set(('char', 'int', 'long')), - 'signed': set(('char', 'int', 'long')), - 'short': set(('int', 'short')), + 'unsigned': set(('char', 'short', 'int', 'long')), + 'signed': set(('char', 'short', 'int', 'long')), + 'short': set(('int',)), 'long': set(('int', 'long', 'double')) } diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 696e5f1d0..3b378001f 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -103,7 +103,7 @@ class AutodocReporter(object): return getattr(self.reporter, name) def system_message(self, level, message, *children, **kwargs): - if 'line' in kwargs: + if 'line' in kwargs and 'source' not in kwargs: try: source, line = self.viewlist.items[kwargs['line']] except IndexError: @@ -681,7 +681,7 @@ class Documenter(object): # make sure that the result starts with an empty line. This is # necessary for some situations where another directive preprocesses # reST and no starting newline is present - self.add_line(u'', '') + self.add_line(u'', '') # format the object's signature, if any sig = self.format_signature() diff --git a/tests/root/autodoc.txt b/tests/root/autodoc.txt index c718feb4c..5c03f947c 100644 --- a/tests/root/autodoc.txt +++ b/tests/root/autodoc.txt @@ -26,3 +26,9 @@ Just testing a few autodoc possibilities... .. autoclass:: CustomDict :show-inheritance: :members: + + +.. automodule:: autodoc_fodder + :noindex: + + .. autoclass:: MarkupError diff --git a/tests/test_build_html.py b/tests/test_build_html.py index fee4b3893..df4d5ad56 100644 --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -32,6 +32,9 @@ def teardown_module(): html_warnfile = StringIO() ENV_WARNINGS = """\ +%(root)s/autodoc_fodder.py:docstring of autodoc_fodder\\.MarkupError:2: \ +\\(WARNING/2\\) Explicit markup ends without a blank line; unexpected \ +unindent\\.\\n? %(root)s/images.txt:9: WARNING: image file not readable: foo.png %(root)s/images.txt:23: WARNING: nonlocal image URI found: \ http://www.python.org/logo.png