]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-100980: ctypes: Test, document, and fix finalizing _fields_ (GH-124292)
authorPetr Viktorin <encukou@gmail.com>
Tue, 24 Sep 2024 00:40:53 +0000 (02:40 +0200)
committerGitHub <noreply@github.com>
Tue, 24 Sep 2024 00:40:53 +0000 (02:40 +0200)
commitbe76e3f26e0b907f711497d006b8b83bff04c036
tree4895db53ed181dc2baab260a7655fed614697dac
parente256a7590a0149feadfef161ed000991376dc0e8
gh-100980: ctypes: Test, document, and fix finalizing _fields_ (GH-124292)

- If setting `_fields_` fails, e.g. with AttributeError, don't set the attribute in `__dict__`
- Document the “finalization” behaviour
- Beef up tests: add `getattr`, test Union as well as Structure
- Put common functionality in a common function

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Doc/library/ctypes.rst
Lib/test/test_ctypes/test_struct_fields.py
Misc/NEWS.d/next/Library/2024-09-20-18-23-19.gh-issue-100980.8nVAB6.rst [new file with mode: 0644]
Modules/_ctypes/_ctypes.c