-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
bpo-39593: Adding an unit test of ctypes #18424
Conversation
Codecov Report
@@ Coverage Diff @@
## master #18424 +/- ##
===========================================
+ Coverage 82.19% 83.19% +0.99%
===========================================
Files 1957 1570 -387
Lines 589306 414436 -174870
Branches 44428 44428
===========================================
- Hits 484409 344788 -139621
+ Misses 95235 59998 -35237
+ Partials 9662 9650 -12
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM on my side.
@vstinner Can you please take a look?
Oops, I had a pending comment that I never submitted! |
I always forget to submit too ; ) |
Modules/_ctypes/cfield.c
Outdated
@@ -1289,7 +1289,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)? */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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?
Co-authored-by: Victor Stinner <[email protected]>
Thanks, merged. |
Thanks, victor. |
https://bugs.python.org/issue39593