Skip to content

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

Merged
rwgk merged 1 commit into
pybind:smart_holderfrom
rwgk:refcount_ne_1_value_error
Mar 3, 2021
Merged

Changing all but one std::runtime_error to std::invalid_argument.#2883
rwgk merged 1 commit into
pybind:smart_holderfrom
rwgk:refcount_ne_1_value_error

Conversation

@rwgk

@rwgkrwgk commented Mar 3, 2021

Copy link
Copy Markdown
Collaborator

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`.
@rwgkrwgk closed this Mar 3, 2021
@rwgkrwgk reopened this Mar 3, 2021
@rwgk

rwgk commented Mar 3, 2021

Copy link
Copy Markdown
CollaboratorAuthor

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_holderMar 3, 2021
@github-actionsgithub-actionsBot added the needs changelog Possibly needs a changelog entry label Mar 3, 2021
@rwgkrwgk 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 <rwgk@google.com>
- 6a7e9f42fe6301e2aa02d5048d8bf752236053db Changing all but one std::runtime_error to std::invalid_a... by Ralf W. Grosse-Kunstleve <rwgk@google.com>
PiperOrigin-RevId: 360746914
@EricCousineau-TRIEricCousineau-TRI added the smart holder See: https://github.com/pybind/pybind11/blob/smart_holder/README_smart_holder.rst label Apr 26, 2021
@rwgkrwgk mentioned this pull request Feb 10, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

smart holderSee: 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

@rwgk@EricCousineau-TRI