Skip to content

gh-90120: Specify UTF-8 encoding in PyModule_AddString{Constant,Macro} docs#131597

Open
dan-wilton wants to merge 2 commits intopython:mainfrom
dan-wilton:update-pymodule-addstring-docs
Open

gh-90120: Specify UTF-8 encoding in PyModule_AddString{Constant,Macro} docs#131597
dan-wilton wants to merge 2 commits intopython:mainfrom
dan-wilton:update-pymodule-addstring-docs

Conversation

@dan-wilton
Copy link
Copy Markdown

@dan-wilton dan-wilton commented Mar 23, 2025

This is my first commit(s) and PR to cpython, thought I'd pick up some docs updates first 📝😄

Issue: #90120


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

@ghost
Copy link
Copy Markdown

ghost commented Mar 23, 2025

All commit authors signed the Contributor License Agreement.
CLA signed

ZeroIntensity
ZeroIntensity previously approved these changes Mar 27, 2025
@hugovk hugovk removed the needs backport to 3.12 only security fixes label Apr 10, 2025
@serhiy-storchaka serhiy-storchaka added the needs backport to 3.14 bugs and security fixes label May 8, 2025
Comment thread Doc/c-api/module.rst
Comment on lines +657 to +658
*STRINGLIB_TYPE_NAME* to *module*. The string *value* must be
``NULL``-terminated and UTF-8 encoded.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

value is not a variable we know about here. It makes sense for PyModule_AddStringConstant because there's a value parameter.

Instead, let's do something like this:

Suggested change
*STRINGLIB_TYPE_NAME* to *module*. The string *value* must be
``NULL``-terminated and UTF-8 encoded.
*STRINGLIB_TYPE_NAME* to *module*. The contents of the macro must be
``NULL``-terminated and UTF-8 encoded.

I think it would also make more sense to move that sentence to before "For example".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about:

Suggested change
*STRINGLIB_TYPE_NAME* to *module*. The string *value* must be
``NULL``-terminated and UTF-8 encoded.
*STRINGLIB_TYPE_NAME* to *module*.
The macro must expand to a NUL-terminated UTF-8 encoded C string.

Or “NULL-terminated” -- but not with the backticks: NULL is a pointer, not a byte.

@github-actions
Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes skip news stale Stale PR or inactive for long period of time. topic-C-API

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

5 participants