ctypes: remove use of legacy unicode API by methane · Pull Request #12340 · python/cpython
Conversation
| // 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"); |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth providing in the exception message the provided length and what the max length actually is?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
methane
deleted the
ctypes-legacy-api
branch
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