This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2014年09月01日 21:32 by vstinner, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| unicode_aswidechar.patch | vstinner, 2014年09月02日 07:52 | |||
| Messages (5) | |||
|---|---|---|---|
| msg226244 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2014年09月01日 21:32 | |
I would like to deprecate PyUnicode_AsUnicode(), see the issue #22271 for the rationale (hint: memory footprint). The first step is to rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString() to not call PyUnicode_AsUnicode() anymore. Attached patch implements this. The code is based on PyUnicode_AsUnicode(), but it's more tricky because PyUnicode_AsWideChar() can truncate the string, and PyUnicode_AsUnicode() does no copy characters if kind == sizeof(wchar_t), PyASCIIObject.wstr "just" points to data. I hate PyUnicode_AsWideChar(), but we must keep it for backward compatibility :-) It would be possible to write an optimized PyUnicode_AsWideCharString() which computes the length, allocate memory and write wide characters, but I don't want to have 3 functions converting a Python string to a wide character string. There are already PyUnicode_AsUnicodeAndSize() and unicode_aswidechar() (+ unicode_aswidechar_len()). |
|||
| msg226260 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2014年09月02日 02:37 | |
> Attached patch implements this. There is no patch. |
|||
| msg226264 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2014年09月02日 07:52 | |
> There is no patch. You're right. Here it is. |
|||
| msg226515 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2014年09月06日 20:17 | |
Hmm... sorry for the delay, there's no review link. Perhaps the patch is not against the latest default? |
|||
| msg322253 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2018年07月23日 20:12 | |
Oh, I have reimplemented this in issue30863. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:07 | admin | set | github: 66519 |
| 2018年07月23日 20:12:05 | serhiy.storchaka | set | messages: + msg322253 |
| 2015年10月02日 21:06:09 | vstinner | set | status: open -> closed resolution: wont fix |
| 2014年10月09日 09:08:27 | vstinner | set | title: Rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString() -> Rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString(): don't cache the result |
| 2014年09月06日 20:17:56 | pitrou | set | messages: + msg226515 |
| 2014年09月04日 10:47:28 | vstinner | set | nosy:
+ serhiy.storchaka |
| 2014年09月02日 07:52:30 | vstinner | set | files:
+ unicode_aswidechar.patch keywords: + patch messages: + msg226264 |
| 2014年09月02日 02:37:57 | pitrou | set | nosy:
+ pitrou messages: + msg226260 |
| 2014年09月01日 21:32:14 | vstinner | create | |