Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sphinx 4.3 fails when importing PyQt5.QtCore.pyqtSignal #9879

Closed
bicobus opened this issue Nov 21, 2021 · 1 comment
Closed

Sphinx 4.3 fails when importing PyQt5.QtCore.pyqtSignal #9879

bicobus opened this issue Nov 21, 2021 · 1 comment

Comments

@bicobus
Copy link

bicobus commented Nov 21, 2021

Describe the bug

With Sphinx 4.3, usage of pyqtSignal will fail with the following error:

  File ".../lib/python3.8/site-packages/sphinx/util/docstrings.py", line 75, in prepare_docstring
    lines = s.expandtabs(tabsize).splitlines()
AttributeError: 'getset_descriptor' object has no attribute 'expandtabs'

Using exact same codebase, Sphinx 4.2 doesn't have such issue.

Investigating why, I stumbled upon the following:

> .../lib/python3.8/site-packages/sphinx/util/docstrings.py(75)prepare_docstring()
-> lines = s.expandtabs(tabsize).splitlines()
(Pdb) l
 70  	        ignore = 1
 71  	    else:
 72  	        warnings.warn("The 'ignore' argument to prepare_docstring() is deprecated.",
 73  	                      RemovedInSphinx50Warning, stacklevel=2)
 74  	
 75  ->	    lines = s.expandtabs(tabsize).splitlines()
 76  	    # Find minimum indentation of any non-blank lines after ignored lines.
 77  	    margin = sys.maxsize
 78  	    for line in lines[ignore:]:
 79  	        content = len(line.lstrip())
 80  	        if content:
(Pdb) interact
*interactive*
>>> s
<attribute '__doc__' of 'PyQt5.QtCore.pyqtSignal' objects>
>>> dir(s)
['__class__', '__delattr__', '__delete__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__get__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__set__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']
>>> 
now exiting InteractiveConsole...
(Pdb) 
make: *** [Makefile:19: html] Error 2

Removing references to pyqtSignal allows sphinx to successfully compile the documentation.

How to Reproduce

Assuming you can quickstart the sphinxdocs folder yourself, insert the following snippet into a file and run sphinx against it.

from PyQt5.QtCore import pyqtSignal

class test:
    """test"""
    x = pyqtSignal([tuple])

Don't forget to install PyQt5:

$ pip install PyQt5

Expected behavior

No response

Your project

Please follow reproduction steps.

Screenshots

No response

OS

Linux

Python version

3.8

Sphinx version

4.3.0

Sphinx extensions

No response

Extra tools

No response

Additional context

No response

@tk0miya tk0miya added this to the 4.3.1 milestone Nov 21, 2021
@tk0miya
Copy link
Member

tk0miya commented Nov 21, 2021

Thank you for reporting.

>>> s
<attribute '__doc__' of 'PyQt5.QtCore.pyqtSignal' objects>

Hmm... I feel this pyqtSignal is broken because it returns non-string object as __doc__...

tk0miya added a commit to tk0miya/sphinx that referenced this issue Nov 21, 2021
tk0miya added a commit that referenced this issue Nov 22, 2021
Fix #9879: autodoc: AttributeError for object having invalid __doc__
@tk0miya tk0miya closed this as completed Nov 22, 2021
bicobus added a commit to bicobus/qModManager that referenced this issue Nov 26, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants