Skip to content
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

Naively implementing Element on arbitrary object causes segfault. #207

Closed
TimAWescott opened this issue Sep 21, 2021 · 2 comments · Fixed by #213
Closed

Naively implementing Element on arbitrary object causes segfault. #207

TimAWescott opened this issue Sep 21, 2021 · 2 comments · Fixed by #213

Comments

@TimAWescott
Copy link

I don't know if it's possible to build a fence around the underlying problem that kept #143 from being accepted, but I just ran into it, or something that looks like it, while attempting to return an array of structures.

See the example. Basically, I looked at the documentation and did the obvious for SomeStruct and Element, and ended up with a segfault generating machine.

Assuming that the underlying problem that causes a segfault in PyFinalizeEx can't be fixed, it would be nice if the documentation for Element had some verbiage along the lines of "don't do this, you'll be sorry". Better, if it's achievable, would be a way to generate a build-time fault if you try.

Reproducible example:

example.zip

@davidhewitt
Copy link
Member

It should probably be an unsafe Trait?

@kngwyu
Copy link
Member

kngwyu commented Nov 5, 2021

Thanks, yes, I agree that it should be unsafe

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 a pull request may close this issue.

3 participants