Sphinx: autodoc does not recognize cython_function_or_method

Created on 8 Aug 2020  路  4Comments  路  Source: sphinx-doc/sphinx

First of all, congratulations on the new release 3.2! I've been waiting for it for quite a while.

Describe the bug

When I try to build the HTML pages using make html, autodoc throw an exception about not expecting cython_function_or_method. On Sphinx 3.1.2 this doesn't happen.

To Reproduce

Steps to reproduce the behavior:

$ git clone --single-branch --branch gh-pages https://github.com/McSinyx/palace
$ cd palace
$ pip install palace==0.2.1 Sphinx==3.2.0
$ cd docs
$ make htmlRunning Sphinx v3.2.0
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 17 source files that are out of date
updating environment: [new config] 17 added, 0 changed, 0 removed
reading sources... [ 35%] reference/buffer                                                                                                                                      
Extension error:
Handler <function _process_docstring at 0x7f47a189c550> for event 'autodoc-process-docstring' threw an exception (exception: module, class, method, function, traceback, frame, or code object was expected, got cython_function_or_method)
make: *** [Makefile:20: html] Error 2

Currently palace only have binary builds for Python 3.6+ on GNU/Linux (and for Python 3.6 on macOS, but I doubt if anyone is still using Python 3.6 anymore), so if you don't have GNU/Linux I'll work out a more minimal Cython module to facilitate the debugging progress.

Your project

For convenience purposes, I'm leaving a snapshot of our project gh-pages branch here as well: palace-gh-pages.zip

Environment info

  • OS: Debian GNU/Linux testing
  • Python version: 3.8.5
  • Sphinx version: 3.2.0
  • Sphinx extensions: sphinx.ext.autodoc
  • Extra tools: Cython 0.29.21
bug napoleon

Most helpful comment

I merged #8077 now. I'll wait for another critical bug report to 3.2.0 for a while and release this as 3.2.1 within a week.

All 4 comments

Sorry for inconvience. I confirmed the error with following Dockerfile:

FROM python:3.8-slim

RUN apt update; apt install -y build-essential curl git make unzip vim
RUN git clone --single-branch --branch gh-pages https://github.com/McSinyx/palace
RUN pip install palace==0.2.1 Sphinx==3.2.0
RUN apt install -y libjack-dev libpulse-dev libasound-dev
WORKDIR /palace
RUN make html SPHINXOPTS=-T

It seems the bug was added by #7690 (cc: @keewis ). I'll try to fix it soon.

Thank you for the prompt response and I'm sorry for not providing sufficient information (about the napoleon plugin used and that palace needs an audio backend to be imported by autodoc) so that you had to figured it out yourself. The PR you linked looks awesome and I can't wait to try it out once this issue is resolved!

I merged #8077 now. I'll wait for another critical bug report to 3.2.0 for a while and release this as 3.2.1 within a week.

Thanks, I can confirm that it is working now!

Was this page helpful?
0 / 5 - 0 ratings