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

Throw exception on returning a unique_ptr or shared_ptr nullptr (or any other holder type) from py::init, rather than crashing #2430

Merged

Conversation

YannickJadoul
Copy link
Collaborator

One overload of the implementation of py::init was missing this check for a null pointer that's present in the other two. This should fix it.

Crash found by @rgkw in #2152 (comment).

…ny other holder type) from py::init, rather than crashing
Copy link
Collaborator

@rwgk rwgk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Yannick for jumping in plugging this hole!

@YannickJadoul
Copy link
Collaborator Author

YannickJadoul commented Aug 24, 2020

Thanks Yannick for jumping in plugging this hole!

Got curious ;-)

Let's get one more review (@henryiii, @bstaletic, or maybe @EricCousineau-TRI? Don't know who's familiar with this part of the code). Then we should be fine, given how minor this change is :-)

Copy link
Collaborator

@bstaletic bstaletic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me.

@YannickJadoul
Copy link
Collaborator Author

Ow, I had tagged the wrong @henryiii, in the comment before. But given @bstaletic's review, I'll merge tomorrow morning, if no one speaks up :-)

@YannickJadoul
Copy link
Collaborator Author

OK, merging :-) If there's still a problem we overlooked, it can be fixed later.

@YannickJadoul YannickJadoul merged commit a2bb297 into pybind:master Aug 25, 2020
@YannickJadoul YannickJadoul deleted the fix-init-unique-shared-nullptr branch August 25, 2020 16:51
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.

3 participants