Skip to content

Python 3.10.7 Docs fails with Sphinx 5.3.0 #98366

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

Closed
marxin opened this issue Oct 17, 2022 · 6 comments
Closed

Python 3.10.7 Docs fails with Sphinx 5.3.0 #98366

marxin opened this issue Oct 17, 2022 · 6 comments
Labels
docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error

Comments

@marxin
Copy link

marxin commented Oct 17, 2022

Noticed that here:
https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:L/python310:doc/standard/x86_64

[   32s] + /usr/bin/make -O -j8 V=1 VERBOSE=1 -j1 html
[   32s] mkdir -p build
[   32s] Using existing Misc/NEWS file
[   32s] PATH=./venv/bin:$PATH sphinx-build -b html -d build/doctrees  -j auto  -W . build/html 
[   33s] Running Sphinx v5.3.0
[   33s] making output directory... done
[   33s] building [mo]: targets for 0 po files that are out of date
[   33s] building [html]: targets for 487 source files that are out of date
[   34s] updating environment: [new config] 487 added, 0 changed, 0 removed
[   34s] 
[   34s] Sphinx parallel build error:
[   34s] KeyError: 'sphinx'

The problematic line:
395 label = translators['sphinx'].gettext(label)

If I print the content of translators I get:

{('console', 'sphinx'): <gettext.NullTranslations object at 0x7ffff7664eb0>, ('general', 'sphinx'): <gettext.NullTranslations object at 0x7ffff6113cd0>, ('general', 'sphinxcontrib.applehelp'): <gettext.NullTranslations object at 0x7ffff5620910>, ('console', 'sphinxcontrib.applehelp'): <gettext.NullTranslations object at 0x7ffff56209d0>, ('general', 'sphinxcontrib.devhelp'): <gettext.NullTranslations object at 0x7ffff5622d40>, ('console', 'sphinxcontrib.devhelp'): <gettext.NullTranslations object at 0x7ffff5623e20>, ('general', 'sphinxcontrib.htmlhelp'): <gettext.NullTranslations object at 0x7ffff5623f10>, ('console', 'sphinxcontrib.htmlhelp'): <gettext.NullTranslations object at 0x7ffff5623f40>, ('general', 'sphinxcontrib.serializinghtml'): <gettext.NullTranslations object at 0x7ffff564ceb0>, ('console', 'sphinxcontrib.serializinghtml'): <gettext.NullTranslations object at 0x7ffff564cf10>, ('general', 'sphinxcontrib.qthelp'): <gettext.NullTranslations object at 0x7ffff564cfa0>, ('console', 'sphinxcontrib.qthelp'): <gettext.NullTranslations object at 0x7ffff564d630>, ('general', 'about'): <gettext.NullTranslations object at 0x7ffff56a2830>, ('general', 'bugs'): <gettext.NullTranslations object at 0x7ffff56a3790>, ('general', 'c-api'): <gettext.NullTranslations object at 0x7ffff536a800>}

@AA-Turner

@marxin marxin added the type-bug An unexpected behavior, bug, or error label Oct 17, 2022
@marxin
Copy link
Author

marxin commented Oct 17, 2022

python.log.txt

@marxin
Copy link
Author

marxin commented Oct 18, 2022

CCing the hunk author: @zooba.

@mattwang44
Copy link
Contributor

mattwang44 commented Oct 19, 2022

This issue is also observed in the python-docs-zh-tw's CI jobs for building the translated Python 3.11 doc. Here is the sample GitHub Action log.

sphinx.locale.translators is originally a defaultdict(gettext.NullTranslations) but changed to a dict in this commit. Modify pyspecific.py's translators['sphinx'] (3 occurrences) to translators[('general', 'sphinx')] should probably solve the issue?

@marxin
Copy link
Author

marxin commented Oct 19, 2022

Modify pyspecific.py's translators['sphinx'] (3 occurrences) to translators[('general', 'sphinx')] should probably solve the issue?

Great you found the commit which caused that. Can you please create a pull request that will make the change?

@AA-Turner
Copy link
Member

I believe sphinx.locale._ could be used to the same effect, which is backwards compatible.

A

@marxin marxin changed the title Python 3.10.7 Docs fails with Sphixn 5.3.0 Python 3.10.7 Docs fails with Sphinx 5.3.0 Oct 19, 2022
@AlexWaygood AlexWaygood added the docs Documentation in the Doc dir label Oct 19, 2022
ezio-melotti pushed a commit that referenced this issue Nov 11, 2022
fix(doc-tools): use sphinx.locale._ as gettext() for backward-compatibility in pyspecific.py

[why] spinix 5.3 changed locale.translators from a defaultdict(gettext.NullTranslations) to a dict, which leads to failure of pyspecific.py. Use sphinx.locale._ as gettext to fix the issue.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 11, 2022
…thonGH-98437)

fix(doc-tools): use sphinx.locale._ as gettext() for backward-compatibility in pyspecific.py

[why] spinix 5.3 changed locale.translators from a defaultdict(gettext.NullTranslations) to a dict, which leads to failure of pyspecific.py. Use sphinx.locale._ as gettext to fix the issue.
(cherry picked from commit d26ee8a)

Co-authored-by: Wei-Hsiang (Matt) Wang <mattwang44@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 11, 2022
…thonGH-98437)

fix(doc-tools): use sphinx.locale._ as gettext() for backward-compatibility in pyspecific.py

[why] spinix 5.3 changed locale.translators from a defaultdict(gettext.NullTranslations) to a dict, which leads to failure of pyspecific.py. Use sphinx.locale._ as gettext to fix the issue.
(cherry picked from commit d26ee8a)

Co-authored-by: Wei-Hsiang (Matt) Wang <mattwang44@gmail.com>
miss-islington added a commit that referenced this issue Nov 11, 2022
fix(doc-tools): use sphinx.locale._ as gettext() for backward-compatibility in pyspecific.py

[why] spinix 5.3 changed locale.translators from a defaultdict(gettext.NullTranslations) to a dict, which leads to failure of pyspecific.py. Use sphinx.locale._ as gettext to fix the issue.
(cherry picked from commit d26ee8a)

Co-authored-by: Wei-Hsiang (Matt) Wang <mattwang44@gmail.com>
miss-islington added a commit that referenced this issue Nov 11, 2022
fix(doc-tools): use sphinx.locale._ as gettext() for backward-compatibility in pyspecific.py

[why] spinix 5.3 changed locale.translators from a defaultdict(gettext.NullTranslations) to a dict, which leads to failure of pyspecific.py. Use sphinx.locale._ as gettext to fix the issue.
(cherry picked from commit d26ee8a)

Co-authored-by: Wei-Hsiang (Matt) Wang <mattwang44@gmail.com>
ethanfurman pushed a commit to ethanfurman/cpython that referenced this issue Nov 12, 2022
…thon#98437)

fix(doc-tools): use sphinx.locale._ as gettext() for backward-compatibility in pyspecific.py

[why] spinix 5.3 changed locale.translators from a defaultdict(gettext.NullTranslations) to a dict, which leads to failure of pyspecific.py. Use sphinx.locale._ as gettext to fix the issue.
@hauntsaninja
Copy link
Contributor

Thanks for fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

5 participants