From 992526def0a1fe3d04c947c540b0c42229505058 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Wed, 7 Apr 2010 11:45:36 +0200 Subject: [PATCH] #376: In autodoc, fix display of parameter defaults containing backslashes. --- CHANGES | 3 +++ sphinx/ext/autodoc.py | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 22380a300..979352aa0 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ Release 0.6.6 (in development) ============================== +* #376: In autodoc, fix display of parameter defaults containing + backslashes. + * #370: Fix handling of complex list item labels in LaTeX output. * #374: Make the ``doctest_path`` config value of the doctest diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 676740671..084ae1552 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -813,7 +813,10 @@ class FunctionDocumenter(ModuleLevelDocumenter): argspec = inspect.getargspec(self.object.__init__) if argspec[0]: del argspec[0][0] - return inspect.formatargspec(*argspec) + args = inspect.formatargspec(*argspec) + # escape backslashes for reST + args = args.replace('\\', '\\\\') + return args def document_members(self, all_members=False): pass