From 99e12d539bb2c71a48ff2fddab5cc5cd45c38cfb Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Thu, 23 Jun 2016 14:37:12 +0200 Subject: [PATCH] DOC: fix accessor docs for sphinx > 1.3 (GH12161) --- doc/source/conf.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 87510d13ee484..6ceeee4ad6afb 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -318,6 +318,7 @@ # Add custom Documenter to handle attributes/methods of an AccessorProperty # eg pandas.Series.str and pandas.Series.dt (see GH9322) +import sphinx from sphinx.util import rpartition from sphinx.ext.autodoc import Documenter, MethodDocumenter, AttributeDocumenter from sphinx.ext.autosummary import Autosummary @@ -365,7 +366,10 @@ def resolve_name(self, modname, parents, path, base): if not modname: modname = self.env.temp_data.get('autodoc:module') if not modname: - modname = self.env.temp_data.get('py:module') + if sphinx.__version__ > '1.3': + modname = self.env.ref_context.get('py:module') + else: + modname = self.env.temp_data.get('py:module') # ... else, it stays None, which means invalid return modname, parents + [base]