Repository navigation
[3.15] gh-156106: Add tests for setting and deleting attributes defined in C (GH-156107) - #159086
Merged
serhiy-storchaka merged 1 commit intoOct 9, 2026
Merged
Conversation
… defined in C (pythonGH-156107) Test setting a value of an accepted type, of a wrong type and an invalid value, and deleting the attribute, for the attributes defined with PyMemberDef and PyGetSetDef which were not covered. (cherry picked from commit cdca502) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka
requested review from
1st1,
asvetlov,
erlend-aasland,
gpshead,
iritkatriel,
kumaraditya303,
picnixz and
willingc
as code owners
October 9, 2026 20:47
serhiy-storchaka
enabled auto-merge (squash)
October 9, 2026 21:01
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test setting a value of an accepted type, of a wrong type and an invalid value, and deleting the attribute, for the attributes defined with
PyMemberDefandPyGetSetDefwhich were not covered.(cherry picked from commit cdca502)
There were conflicts in four test files, resolved by adding only what this commit contributes:
Lib/test/test_ctypes/test_delattr.py-- the import keeps the names already imported on 3.15 and adds onlyCDLLandimport_helper.POINTERis not added, because the test which uses it on the main branch is not in 3.15.Lib/test/test_io/test_textio.py--test_chunk_size()is added beforetest_reentrant_seek_during_tell(), which is at the start ofCTextIOWrapperTeston 3.15 and further down on the main branch.Lib/test/test_sqlite3/test_dbapi.py-- only thedelattr()assertion is added totest_invalid_array_size(). The checks for2**1000and for the value after a failed assignment come from a change which is not in 3.15.Lib/test/test_ssl.py-- only the two new tests are added.test__create_stdlib_context_check_hostname(), which precedes them on the main branch, is not in 3.15.test_delete_sslobject_attributes()is taken in the form it currently has on the main branch, which setsctx.check_hostnameto false. This is needed on 3.15, because GH-158503 (gh-156793), which madewrap_bio()validate its parameters, is already backported, whereas on the main branch it landed after this commit.