Skip to content

Commit 01e3de4

Browse files
DOC: fix accessor docs for sphinx > 1.3 (GH12161) (pandas-dev#13499)
1 parent 48f0c3a commit 01e3de4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

doc/source/conf.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@
318318
# Add custom Documenter to handle attributes/methods of an AccessorProperty
319319
# eg pandas.Series.str and pandas.Series.dt (see GH9322)
320320

321+
import sphinx
321322
from sphinx.util import rpartition
322323
from sphinx.ext.autodoc import Documenter, MethodDocumenter, AttributeDocumenter
323324
from sphinx.ext.autosummary import Autosummary
@@ -365,7 +366,10 @@ def resolve_name(self, modname, parents, path, base):
365366
if not modname:
366367
modname = self.env.temp_data.get('autodoc:module')
367368
if not modname:
368-
modname = self.env.temp_data.get('py:module')
369+
if sphinx.__version__ > '1.3':
370+
modname = self.env.ref_context.get('py:module')
371+
else:
372+
modname = self.env.temp_data.get('py:module')
369373
# ... else, it stays None, which means invalid
370374
return modname, parents + [base]
371375

0 commit comments

Comments
 (0)