python / cpython

The Python programming language
https://www.python.org
Other
63.5k stars 30.41k forks source link

Clarify that PyModule_AddString{Constant,Macro} use utf-8 #90120

Open 379dc349-3a10-424f-b9d2-a0104f092359 opened 2 years ago

379dc349-3a10-424f-b9d2-a0104f092359 commented 2 years ago
BPO 45962
Nosy @anntzer

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields: ```python assignee = None closed_at = None created_at = labels = ['expert-C-API', '3.11', 'type-feature', 'docs'] title = 'Clarify that PyModule_AddString{Constant,Macro} use utf-8' updated_at = user = 'https://github.com/anntzer' ``` bugs.python.org fields: ```python activity = actor = 'AlexWaygood' assignee = 'docs@python' closed = False closed_date = None closer = None components = ['Documentation', 'C API'] creation = creator = 'Antony.Lee' dependencies = [] files = [] hgrepos = [] issue_num = 45962 keywords = [] message_count = 1.0 messages = ['407518'] nosy_count = 2.0 nosy_names = ['docs@python', 'Antony.Lee'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = 'enhancement' url = 'https://bugs.python.org/issue45962' versions = ['Python 3.11'] ```

379dc349-3a10-424f-b9d2-a0104f092359 commented 2 years ago

The documentation for PyModule_AddString{Constant,Macro} does not specify the encoding used. Checking the source shows that these simply call PyUnicode_FromString and thus use utf8, but perhaps this could be made explicit.