Repository navigation
bpo-39593: Adding an unit test of ctypes #18424
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 2 commits
7727b2d
f013d98
ab1a72d
dfa4d1b
fd6c06c
bc3b678
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1294,7 +1294,9 @@ s_set(void *ptr, PyObject *value, Py_ssize_t length) | |
| } | ||
|
|
||
| data = PyBytes_AS_STRING(value); | ||
| size = strlen(data); /* XXX Why not Py_SIZE(value)? */ | ||
| /* bpo-39593: XXX Why not Py_SIZE(value)? */ | ||
|
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. I don't think that it's correct to add a test which indirectly specify the behavior and keep this comment which suggests to change the behavior. I suggest to rewrite the comment to explain that we do use strlen() on purpose, rather than PyBytes_GET_SIZE() since we truncate characters after a null character on purpose. Keep the bpo number in the comment.
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. Thanks, got it. I updated the description info, do you think it's clear enough? |
||
| size = strlen(data); | ||
|
shihai1991 marked this conversation as resolved.
Resolved
|
||
|
|
||
| if (size < length) { | ||
| /* This will copy the terminating NUL character | ||
| * if there is space for it. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.