Bug 1975260

Summary: Broken import with sphinx4: ImportError: cannot import name 'force_decode' from 'sphinx.util'
Product: [Fedora] Fedora Reporter: Miroslav Suchý <msuchy>
Component: python-sphinxcontrib-httpdomainAssignee: Dan Callaghan <djc>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 35CC: djc, ksurma, mhroncok, praiskup
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-08-23 07:28:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1973718, 1977664, 1981749    

Description Miroslav Suchý 2021-06-23 11:00:44 UTC
Description of problem:
With Sphinx4 
  https://fedoraproject.org/wiki/Changes/Sphinx4
the python3-sphinxcontrib-httpdomain raise a traceback when used in Sphinx.

In /usr/lib/python3.10/site-packages/sphinxcontrib/autohttp/flask.py
there is a line which cause this error:

>>> from sphinx.util import force_decode
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'force_decode' from 'sphinx.util' (/usr/lib/python3.10/site-packages/sphinx/util/__init__.py)


Version-Release number of selected component (if applicable):
python3-sphinxcontrib-httpdomain-1.7.0-12.fc35.noarch
python3-sphinx-4.0.2-3.fc35.noarch

How reproducible:
always 

Steps to Reproduce:
1. mock -r fedora-rawhide-x86_64 --addrepo=https://download.copr.fedorainfracloud.org/results/ksurma/pygments-2.9.0/fedora-rawhide-x86_64/ install python3-sphinxcontrib-httpdomain
2. python3 /usr/lib/python3.10/site-packages/sphinxcontrib/autohttp/flask.py


Actual results:

<mock-chroot> sh-5.1# python3 /usr/lib/python3.10/site-packages/sphinxcontrib/autohttp/flask.py
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/sphinxcontrib/autohttp/flask.py", line 22, in <module>
    from sphinx.util import force_decode
ImportError: cannot import name 'force_decode' from 'sphinx.util' (/usr/lib/python3.10/site-packages/sphinx/util/__init__.py)

Expected results:
no errors

Comment 1 Dan Callaghan 2021-07-19 12:07:52 UTC
Upstream issue:
https://github.com/sphinx-contrib/httpdomain/issues/46

Here is an unmerged PR, it seems to be from a drive-by contributor but the patch looks right to me:
https://github.com/sphinx-contrib/httpdomain/pull/49

Also worth noting that Sphinx appears to have re-added the deprecated `force_decode` function in 4.0.3, due to the number of extensions it broke. But they are still intending to remove it again in future.

Comment 2 Karolina Surma 2021-08-10 12:42:42 UTC
Sphinx was updated to 4.1.2 in Fedora Rawhide, this version contains the re-added `force_decode`. At the moment the issue shall be contained.

Comment 3 Ben Cotton 2021-08-10 13:08:35 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 35 development cycle.
Changing version to 35.

Comment 4 Miroslav Suchý 2021-08-23 07:28:09 UTC
I verified it is working now.