FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-159739: Preserve ctypes base metadata when cloning fails by jelle-openai · Pull Request #160174 · python/cpython · GitHub

Repository navigation

gh-159739: Preserve ctypes base metadata when cloning fails - #160174

Open
jelle-openai wants to merge 1 commit into
python:mainfrom
jelle-openai:jelle/codex/gh-159739-ctypes-clone-ownership
Open

jelle-openai wants to merge 1 commit into
python:mainfrom
jelle-openai:jelle/codex/gh-159739-ctypes-clone-ownership

Conversation

jelle-openai commented Oct 22, 2026 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

When creating a ctypes structure subclass, cloning its layout initially copied pointers to buffers owned by the base class. If a later allocation failed, cleaning up the subclass could free those buffers, leaving the base with invalid metadata and potentially causing a crash. Detach the owned pointers until their copies have been allocated. Backport to 3.15 and 3.14.

When creating a ctypes structure subclass, cloning its layout initially copied pointers to buffers owned by the base class. If a later allocation failed, cleaning up the subclass could free those buffers, leaving the base with invalid metadata and potentially causing a crash. Detach the owned pointers until their copies have been allocated. Backport to 3.15 and 3.14.
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL