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 3.x broken on Python 3.10 #9816

Closed
humitos opened this issue Nov 3, 2021 · 4 comments
Closed

Sphinx 3.x broken on Python 3.10 #9816

humitos opened this issue Nov 3, 2021 · 4 comments

Comments

@humitos
Copy link
Contributor

humitos commented Nov 3, 2021

Describe the bug

It seems that Sphinx 3.x is broken when using Python 3.10 because of this line: https://github.com/sphinx-doc/sphinx/blob/v3.5.4/sphinx/util/typing.py#L33

$ python3.10
Python 3.10.0 (default, Nov  3 2021, 12:30:55) [GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version_info > (3, 10)
True
>>> from types import Union as types_Union
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'Union' from 'types' (/home/humitos/.asdf/installs/python/3.10.0/lib/python3.10/types.py)
>>>

Am I correct?

How to Reproduce

$ pip install "sphinx<4"
$ python3.10
Python 3.10.0 (default, Nov  3 2021, 12:30:55) [GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sphinx.testing import util
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/humitos/rtfd/code/sphinx-notfound-page/.direnv/python-3.10.0/lib/python3.10/site-packages/sphinx/testing/util.py", line 23, in <module>
    from sphinx import application, locale
  File "/home/humitos/rtfd/code/sphinx-notfound-page/.direnv/python-3.10.0/lib/python3.10/site-packages/sphinx/application.py", line 32, in <module>
    from sphinx.config import Config
  File "/home/humitos/rtfd/code/sphinx-notfound-page/.direnv/python-3.10.0/lib/python3.10/site-packages/sphinx/config.py", line 23, in <module>
    from sphinx.util import logging
  File "/home/humitos/rtfd/code/sphinx-notfound-page/.direnv/python-3.10.0/lib/python3.10/site-packages/sphinx/util/__init__.py", line 35, in <module>
    from sphinx.util import smartypants  # noqa
  File "/home/humitos/rtfd/code/sphinx-notfound-page/.direnv/python-3.10.0/lib/python3.10/site-packages/sphinx/util/smartypants.py", line 33, in <module>
    from sphinx.util.docutils import __version_info__ as docutils_version
  File "/home/humitos/rtfd/code/sphinx-notfound-page/.direnv/python-3.10.0/lib/python3.10/site-packages/sphinx/util/docutils.py", line 31, in <module>
    from sphinx.util.typing import RoleFunction
  File "/home/humitos/rtfd/code/sphinx-notfound-page/.direnv/python-3.10.0/lib/python3.10/site-packages/sphinx/util/typing.py", line 34, in <module>
    from types import Union as types_Union
ImportError: cannot import name 'Union' from 'types' (/home/humitos/.asdf/installs/python/3.10.0/lib/python3.10/types.py)

Expected behavior

It should not enter to that if because Python 3.10 version is not greater than (3, 10). It should probably check for

>>> (sys.version_info.major, sys.version_info.minor) > (3, 10)
False

Your project

https://github.com/humitos/sphinx-notfound-page

Screenshots

No response

OS

ArchLinux

Python version

3.10

Sphinx version

3.x

Sphinx extensions

No response

Extra tools

No response

Additional context

No response

@tk0miya
Copy link
Member

tk0miya commented Nov 7, 2021

Why do you use such an old version? Please use 4.2.0.

@humitos
Copy link
Contributor Author

humitos commented Nov 7, 2021

Hi @tk0miya! I don't personally use that version. I'm author and maintainer of an extension and I found this problem while running the extension's tests over different Python and Sphinx versions.

I expect users of the extension to use 3.x and I wanted to have them covered by the test suite. I didn't know you considered 3.x really old since it's the previous version of the current latest.

I'm skipping this combination for now in my tests to workaround the issue.

Feel free to close the issue. Thanks!

@jaraco
Copy link

jaraco commented Nov 7, 2021

Sphinx 4.1.2 has the same issue, and I can't use 4.2.0 due to a bug in that release that I'll report shortly. I was only able to run using sphinx<4.2 and python<3.10.

@tk0miya
Copy link
Member

tk0miya commented Nov 7, 2021

Now we don't have enough resources to maintain old versions. At present, we've supported the latest version only. So I'm closing this now.
Thanks,

@tk0miya tk0miya closed this as completed Nov 7, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 8, 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

3 participants