Skip to content

Conversation

@gpshead
Copy link
Member

@gpshead gpshead commented Jan 26, 2023

backport of #100169

Fixes a reference counting issue with ctypes.Structure when a from_param() method call is used and the structure size is larger than a C pointer sizeof(void*).

This problem existed for a very long time, but became more apparent in 3.8+ by change likely due to garbage collection cleanup timing changes.. (cherry picked from commit dfad678)

Co-authored-by: Yukihiro Nakadaira yukihiro.nakadaira@gmail.com

…esult. (pythonGH-100169)

Fixes a reference counting issue with `ctypes.Structure` when a `from_param()` method call is used and the structure size is larger than a C pointer `sizeof(void*)`.

This problem existed for a very long time, but became more apparent in 3.8+ by change likely due to garbage collection cleanup timing changes..
(cherry picked from commit dfad678)

Co-authored-by: Yukihiro Nakadaira <yukihiro.nakadaira@gmail.com>
@miss-islington
Copy link
Contributor

Thanks @gpshead for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@gpshead gpshead deleted the backport-dfad678-3.11 branch January 26, 2023 09:02
@bedevere-bot
Copy link

GH-101340 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Jan 26, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 26, 2023
…aram() result (pythonGH-101339)

[3.11] pythongh-99952: [ctypes] fix refcount issues in from_param() result. (pythonGH-100169)

Fixes a reference counting issue with `ctypes.Structure` when a `from_param()` method call is used and the structure size is larger than a C pointer `sizeof(void*)`.

This problem existed for a very long time, but became more apparent in 3.8+ by change likely due to garbage collection cleanup timing changes..
(cherry picked from commit dfad678)

(cherry picked from commit fa7c37a)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Yukihiro Nakadaira <yukihiro.nakadaira@gmail.com>
gpshead added a commit that referenced this pull request Feb 4, 2023
…param() result (GH-101339) (#101340)

[3.11] gh-99952: [ctypes] fix refcount issues in from_param() result. (GH-100169)

Fixes a reference counting issue with `ctypes.Structure` when a `from_param()` method call is used and the structure size is larger than a C pointer `sizeof(void*)`.

This problem existed for a very long time, but became more apparent in 3.8+ by change likely due to garbage collection cleanup timing changes..
(cherry picked from commit dfad678)

(cherry picked from commit fa7c37a)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Yukihiro Nakadaira <yukihiro.nakadaira@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic-ctypes type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants