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

Defer None loading to second pass #843

Merged
merged 1 commit into from
May 10, 2017

Conversation

jagerman
Copy link
Member

@jagerman jagerman commented May 9, 2017

Following up the discussion in #839, this changes most of the is_none() checks to defer to the convert = true pass. This makes them consistent with the char caster (which already deferred), and seems more correct. In particular, this allows a py::none overload to be used even if earlier overloads would accept a None.

This keeps None in the no-convert pass for the two type casters where it makes sense: the void caster, and the std::optional caster.

@wjakob
Copy link
Member

wjakob commented May 10, 2017

Makes sense -- LGTM!

@dean0x7d
Copy link
Member

Looks good to me.

Many of our `is_none()` checks in type caster loading return true, but
this should really be considered a deferral so that, for example, an
overload with a `py::none` argument would win over one that takes
`py::none` as a null option.

This keeps None-accepting for the `!convert` pass only for std::optional
and void casters.  (The `char` caster already deferred None; this just
extends that behaviour to other casters).
@jagerman jagerman merged commit 93e3eac into pybind:master May 10, 2017
@dean0x7d dean0x7d modified the milestone: v2.2 Aug 13, 2017
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