Skip to content

Cython guard against [c|m|re]alloc failures #57705

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 2 commits into from
Mar 20, 2024

Conversation

WillAyd
Copy link
Member

@WillAyd WillAyd commented Mar 2, 2024

Not sure if these are testable but in the case of the system being exhausted for resources these should explicitly throw a MemoryError instead of allow undefined behavior

@MarcoGorelli don't know how difficult it would be but would be cool to have the cython linter catch uses of any low-level allocation function and ensure that a guard against NULL comes thereafter. The only exception I could think of to that rule is if you are immediately returning the result of an malloc and expect the caller to guard against NULL, but we don't have any instances of that in our code base (may also not matter for Cython)

@WillAyd WillAyd requested a review from MarcoGorelli as a code owner March 2, 2024 17:42
@WillAyd WillAyd added the Clean label Mar 2, 2024
@mroeschke mroeschke added this to the 3.0 milestone Mar 20, 2024
@mroeschke mroeschke merged commit 114a84d into pandas-dev:main Mar 20, 2024
46 checks passed
@mroeschke
Copy link
Member

Thanks @WillAyd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants