Skip to content

[3.15] gh-156106: Add tests for setting and deleting attributes defined in C (GH-156107) - #159086

Merged
serhiy-storchaka merged 1 commit into
python:3.15from
serhiy-storchaka:backport-cdca502-3.15
Oct 9, 2026
Merged

serhiy-storchaka merged 1 commit into
python:3.15from
serhiy-storchaka:backport-cdca502-3.15

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

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)

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 only CDLL and import_helper. POINTER is 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 before test_reentrant_seek_during_tell(), which is at the start of CTextIOWrapperTest on 3.15 and further down on the main branch.
  • Lib/test/test_sqlite3/test_dbapi.py -- only the delattr() assertion is added to test_invalid_array_size(). The checks for 2**1000 and 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 sets ctx.check_hostname to false. This is needed on 3.15, because GH-158503 (gh-156793), which made wrap_bio() validate its parameters, is already backported, whereas on the main branch it landed after this commit.

… 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant