Skip to content

Remove newline in Doc/c-api/lifecycle.rst for gettext builder #135013

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

Merged
merged 1 commit into from
Jun 2, 2025

Conversation

rffontenelle
Copy link
Contributor

@rffontenelle rffontenelle commented Jun 2, 2025

This newline is causing Sphinx's gettext builder to extract the message including the \n character instead of keeping all in a single string.

For instance, see how that string looks in the translation file for Brazilian Portuguese:

#: ../../c-api/lifecycle.rst:55 ../../c-api/lifecycle.rst:63
msgid ""
"Diagram showing events in an object's life.  Explained in detail\n"
"below."
msgstr ""

📚 Documentation preview 📚: https://cpython-previews--135013.org.readthedocs.build/

Copy link
Contributor

@Yzi-Li Yzi-Li left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 83 characters can be accepted, and it will look more concise.

@picnixz
Copy link
Member

picnixz commented Jun 2, 2025

This newline is causing Sphinx's gettext builder to extract the message including the \n character instead of keeping all in a single string.

Have you tried using a backslash continuation \ instead?

@picnixz picnixz changed the title Remove newline in c-api lifecycle Docs: remove newline in Doc/c-api/lifecycle.rst for gettext builder Jun 2, 2025
@picnixz picnixz changed the title Docs: remove newline in Doc/c-api/lifecycle.rst for gettext builder Remove newline in Doc/c-api/lifecycle.rst for gettext builder Jun 2, 2025
@StanFromIreland
Copy link
Contributor

@picnixz It does not work, as shown below, it will escape the \:

#: ../../c-api/lifecycle.rst:55
msgid "Diagram showing events in an object's life.  Explained in detail \\\n"
"below."
msgstr ""

@picnixz
Copy link
Member

picnixz commented Jun 2, 2025

Interesting. I may consider this to be a bug in docutils or in Sphinx.

I think I actually had a local patch for sphinx when options were incorrectly processed if they were not on the same line, even with a backslash, which is why I assumed it worked.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@serhiy-storchaka serhiy-storchaka merged commit c7051a3 into python:main Jun 2, 2025
41 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Jun 2, 2025
@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jun 2, 2025
@miss-islington-app
Copy link

Thanks @rffontenelle for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @rffontenelle for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 2, 2025
…GH-135013)

(cherry picked from commit c7051a3)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
@miss-islington-app
Copy link

Sorry, @rffontenelle and @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker c7051a366996dd2213decb8677c52d1eda0fde6a 3.13

@bedevere-app
Copy link

bedevere-app bot commented Jun 2, 2025

GH-135038 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jun 2, 2025
@rffontenelle rffontenelle deleted the patch-6 branch June 2, 2025 18:14
@serhiy-storchaka serhiy-storchaka removed the needs backport to 3.13 bugs and security fixes label Jun 2, 2025
serhiy-storchaka pushed a commit that referenced this pull request Jun 2, 2025
…H-135013) (GH-135038)

(cherry picked from commit c7051a3)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
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 skip issue skip news
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants