Repository navigation
ctypes: remove use of legacy unicode API #12340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1311,7 +1311,9 @@ WCharArray_set_value(CDataObject *self, PyObject *value, void *Py_UNUSED(ignored | |
| if (len < 0) { | ||
| return -1; | ||
| } | ||
| if ((size_t)len > self->b_size/sizeof(wchar_t)) { | ||
| // 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)) { | ||
|
methane marked this conversation as resolved.
Outdated
|
||
| PyErr_SetString(PyExc_ValueError, "string too long"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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"). |
||
| result = -1; | ||
| goto done; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.