Issue 25438: document what codec PyMemberDef T_STRING decodes the char * as (original) (raw)

Created on 2015-10-19 06:42 by gregory.p.smith, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 10580 merged Windson Yang,2018-11-17 03:34
PR 10580 merged Windson Yang,2018-11-17 03:34
PR 10580 merged Windson Yang,2018-11-17 03:34
PR 10586 merged miss-islington,2018-11-17 19:17
PR 10587 merged miss-islington,2018-11-17 19:17
Messages (8)
msg253172 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2015-10-19 06:42
https://docs.python.org/3/c-api/structures.html#c.PyMemberDef T_STRING members are turned into str objects in Python. The documentation needs updating to mention which codec the char * bytes are treated as. Solving this issue involves code inspection and leaving pointers to that code here in the issue, then updating the docs to mention the requirements for the char * member data as well as what happens upon assignment for non-READONLY T_STRING data (a different restriction? or encoding to the same codec?) My _guess_ would be UTF-8 or ASCII but I'll let someone else dive in and find out. This is a Python 3 specific documentation clarification.
msg253275 - (view) Author: Josh Rosenberg (josh.r) * (Python triager) Date: 2015-10-21 03:22
Checking the source ( https://hg.python.org/cpython/file/tip/Python/structmember.c#l51 ), it calls PyUnicodeFromString ( https://docs.python.org/3/c-api/unicode.html?highlight=pyunicode_fromstring#c.PyUnicode_FromString ), so it's always interpreted as UTF-8.
msg329773 - (view) Author: Lysandros Nikolaou (lys.nikolaou) * (Python committer) Date: 2018-11-12 23:34
It's been more than 3 years, since this was opened, but I will ask nevertheless. Should a PR maybe made for this issue?
msg329774 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2018-11-12 23:44
it still seems relevant, having better docs is always good.
msg329794 - (view) Author: Windson Yang (Windson Yang) * Date: 2018-11-13 01:56
I will work on it today :D
msg330032 - (view) Author: miss-islington (miss-islington) Date: 2018-11-17 19:16
New changeset 689d555ec135d4115574addd063c358ac4897cc4 by Miss Islington (bot) (Windson yang) in branch 'master': bpo-25438: document what codec PyMemberDef T_STRING decodes the char * as (GH-10580) https://github.com/python/cpython/commit/689d555ec135d4115574addd063c358ac4897cc4
msg330033 - (view) Author: miss-islington (miss-islington) Date: 2018-11-17 19:50
New changeset d1a97b36595726074a83452e5c476806936becba by Miss Islington (bot) in branch '3.7': [3.7] bpo-25438: document what codec PyMemberDef T_STRING decodes the char * as (GH-10580) (GH-10586) https://github.com/python/cpython/commit/d1a97b36595726074a83452e5c476806936becba
msg330034 - (view) Author: miss-islington (miss-islington) Date: 2018-11-17 19:50
New changeset 8945017be4cc9527767bb66673e73e28e4b0b4d3 by Miss Islington (bot) in branch '3.6': [3.6] bpo-25438: document what codec PyMemberDef T_STRING decodes the char * as (GH-10580) (GH-10587) https://github.com/python/cpython/commit/8945017be4cc9527767bb66673e73e28e4b0b4d3
History
Date User Action Args
2022-04-11 14:58:22 admin set github: 69624
2018-11-17 19:51:01 gregory.p.smith set keywords:patch, patch, patch, easystatus: open -> closedstage: patch review -> commit reviewresolution: fixedversions: + Python 3.7, Python 3.8, - Python 3.4, Python 3.5
2018-11-17 19:50:28 miss-islington set messages: +
2018-11-17 19:50:01 miss-islington set messages: +
2018-11-17 19:17:19 miss-islington set pull_requests: + <pull%5Frequest9831>
2018-11-17 19:17:09 miss-islington set pull_requests: + <pull%5Frequest9830>
2018-11-17 19:16:53 miss-islington set nosy: + miss-islingtonmessages: +
2018-11-17 03:34:53 Windson Yang set keywords: + patchstage: needs patch -> patch reviewpull_requests: + <pull%5Frequest9825>
2018-11-17 03:34:48 Windson Yang set keywords: + patchstage: needs patch -> needs patchpull_requests: + <pull%5Frequest9826>
2018-11-17 03:34:44 Windson Yang set keywords: + patchstage: needs patch -> needs patchpull_requests: + <pull%5Frequest9824>
2018-11-13 01:56:09 Windson Yang set nosy: + Windson Yangmessages: +
2018-11-12 23:44:13 gregory.p.smith set messages: +
2018-11-12 23:34:30 lys.nikolaou set nosy: + lys.nikolaoumessages: +
2015-10-21 03:22:07 josh.r set nosy: + josh.rmessages: +
2015-10-19 06:42:04 gregory.p.smith create