Skip to content

gh-100980: ctypes: Test, document, and fix finalizing _fields_ #124292

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

Merged
merged 4 commits into from
Sep 24, 2024

Conversation

encukou
Copy link
Member

@encukou encukou commented Sep 20, 2024

  • 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

P.S. del X._fields_ is still allowed; preventing that is out of scope of this change. Like mutating the list, it doesn't have an effect. (_fields_ is read once, when the class is finalized, and not consulted again.)


📚 Documentation preview 📚: https://cpython-previews--124292.org.readthedocs.build/

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
@encukou encukou merged commit be76e3f into python:main Sep 24, 2024
37 checks passed
@encukou encukou deleted the gh-100980 branch September 24, 2024 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants