Skip to content
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

Merged
merged 6 commits into from
Jun 1, 2020
Merged

Conversation

shihai1991
Copy link
Member

@shihai1991 shihai1991 commented Feb 9, 2020

@codecov
Copy link

codecov bot commented Feb 9, 2020

Codecov Report

Merging #18424 into master will increase coverage by 0.99%.
The diff coverage is n/a.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ
Lib/distutils/tests/test_bdist_rpm.py 30.00% <0.00%> (-65.00%) ⬇️
Lib/distutils/command/bdist_rpm.py 7.63% <0.00%> (-56.88%) ⬇️
Lib/test/test_urllib2net.py 76.92% <0.00%> (-13.85%) ⬇️
Lib/test/test_smtpnet.py 78.57% <0.00%> (-12.86%) ⬇️
Lib/ftplib.py 63.85% <0.00%> (-6.06%) ⬇️
Lib/test/test_ftplib.py 87.11% <0.00%> (-4.72%) ⬇️
Lib/dbm/__init__.py 66.66% <0.00%> (-4.45%) ⬇️
Tools/scripts/db2pickle.py 17.82% <0.00%> (-3.97%) ⬇️
Lib/test/test_socket.py 71.94% <0.00%> (-3.87%) ⬇️
Tools/scripts/pickle2db.py 16.98% <0.00%> (-3.78%) ⬇️
... and 431 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7f6f7ee...f013d98. Read the comment docs.

Copy link
Member

@corona10 corona10 left a 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?

@csabella csabella requested review from vstinner and removed request for vstinner May 25, 2020 17:53
@vstinner
Copy link
Member

Oops, I had a pending comment that I never submitted!

@shihai1991
Copy link
Member Author

Oops, I had a pending comment that I never submitted!

I always forget to submit too ; )

@shihai1991
Copy link
Member Author

shihai1991 commented May 27, 2020

@vstinner Hi, victor. There have a testcase of nomralizeing() in #19069, can you take a look if you have free time, thanks.

@@ -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)? */
Copy link
Member

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.

Copy link
Member Author

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?

Modules/_ctypes/cfield.c Outdated Show resolved Hide resolved
Co-authored-by: Victor Stinner <vstinner@python.org>
@shihai1991 shihai1991 requested a review from vstinner June 1, 2020 16:32
@vstinner vstinner merged commit a97011b into python:master Jun 1, 2020
@vstinner
Copy link
Member

vstinner commented Jun 1, 2020

Thanks, merged.

@shihai1991
Copy link
Member Author

Thanks, merged.

Thanks, victor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants