Bug 1975260 - Broken import with sphinx4: ImportError: cannot import name 'force_decode' from 'sphinx.util'
Summary: Broken import with sphinx4: ImportError: cannot import name 'force_decode' fr...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-sphinxcontrib-httpdomain
Version: 35
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Dan Callaghan
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1973718 1977664 1981749
TreeView+ depends on / blocked
 
Reported: 2021-06-23 11:00 UTC by Miroslav Suchý
Modified: 2021-08-23 07:28 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2021-08-23 07:28:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.