Skip to content

Changing all but one std::runtime_error to std::invalid_argument. #2883

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 1 commit into from
Mar 3, 2021

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented Mar 3, 2021

std::invalid_argument appears as ValueError in the Python interpreter, which is more intuitive than RuntimeError, and compatible with existing PyCLIF behavior.

…ch appears as ValueError in the Python interpreter. Adding `test_cannot_disown_use_count_ne_1`.
@rwgk rwgk closed this Mar 3, 2021
@rwgk rwgk reopened this Mar 3, 2021
@rwgk
Copy link
Collaborator Author

rwgk commented Mar 3, 2021

The CI is green, also with PYBIND11_USE_SMART_HOLDER_AS_DEFAULT (#2879): Merging for easier Google-internal testing. This change will get reviewed internally. I'll open a new PR if there are requests for changes.

@rwgk rwgk merged commit 6a7e9f4 into pybind:smart_holder Mar 3, 2021
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Mar 3, 2021
@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label Mar 3, 2021
@rwgk rwgk deleted the refcount_ne_1_value_error branch March 3, 2021 13:09
rwgk added a commit to google/clif that referenced this pull request Mar 5, 2021
* `shared_ptr<bool> vptr_deleter_armed_flag_ptr` (instead of `unique_ptr`) (pybind/pybind11#2882).
* Changing all but one `std::runtime_error` to `std::invalid_argument` (pybind/pybind11#2883). — `ValueError` is more intuitive and compatible with existing PyCLIF behavior.

This fixes the lifetime issue explained in the "side note" in the description of cl/360478293, and enables two small changes to third_party/clif that are also included in this CL.

TESTED=TGP (http://tap/OCL:360563362:BASE:360596252:1614754358524:3a38713a)

Import pybind/pybind11 from GitHub.

  - 3a336a2047d069081a62338613a747b3d57f645b shared_ptr<bool> vptr_deleter_armed_flag_ptr (instead of ... by Ralf W. Grosse-Kunstleve <[email protected]>
  - 6a7e9f42fe6301e2aa02d5048d8bf752236053db Changing all but one std::runtime_error to std::invalid_a... by Ralf W. Grosse-Kunstleve <[email protected]>

PiperOrigin-RevId: 360746914
@EricCousineau-TRI EricCousineau-TRI added the smart holder See: https://github.com/pybind/pybind11/blob/smart_holder/README_smart_holder.rst label Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
smart holder See: https://github.com/pybind/pybind11/blob/smart_holder/README_smart_holder.rst
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants