FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

ctypes: remove use of legacy unicode API by methane · Pull Request #12340 · python/cpython · GitHub

Repository navigation

ctypes: remove use of legacy unicode API - #12340

Merged
methane merged 4 commits into
python:masterfrom
methane:ctypes-legacy-api
Apr 19, 2019
Merged

methane merged 4 commits into
python:masterfrom
methane:ctypes-legacy-api

Conversation

methane commented Mar 15, 2019

Copy link
Copy Markdown
Member

PyUnicode_AsUnicodeAndSize() -> PyUnicode_AsWideChar()

PyUnicode_AsUnicodeAndSize() -> PyUnicode_AsWideChar()
methane requested a review from abalkin March 15, 2019 11:45
Comment thread Modules/_ctypes/_ctypes.c Outdated
Comment thread Modules/_ctypes/_ctypes.c Outdated
Comment thread Modules/_ctypes/_ctypes.c
// PyUnicode_AsWideChar() returns number of wchars including trailing NUL,
// when it is called with NULL.
if ((size_t)len-1 > self->b_size/sizeof(wchar_t)) {
PyErr_SetString(PyExc_ValueError, "string too long");

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Is it worth providing in the exception message the provided length and what the max length actually is?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Maybe yes. But this file has similar codes which are not relating to wchar_t APIs. ("bytes string too long").
I want to keep this pull request simple.

Comment thread Modules/_ctypes/cfield.c Outdated
brettcannon added the type-bug An unexpected behavior, bug, or error label Apr 17, 2019
Co-Authored-By: methane <songofacandy@gmail.com>
methane merged commit 9d062d6 into python:master Apr 19, 2019
methane deleted the ctypes-legacy-api branch April 19, 2019 07:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip issue skip news type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL