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

Import current pybind/pybind11#5296: Enable type-safe interoperability between different independent Python/C++ bindings systems. #30158

Merged
merged 48 commits into from
Sep 1, 2024

Conversation

rwgk
Copy link
Contributor

@rwgk rwgk commented Sep 1, 2024

Description

See description of pybind/pybind11#5296.

Importing here (squash merge) to facilitate Google-global testing with PyCLIF-pybind11, as an additional stress-test for pybind/pybind11#5296.

Suggested changelog entry:

Ralf W. Grosse-Kunstleve added 30 commits August 11, 2024 12:57
…nters across extensions even if the `PYBIND11_INTERNALS_VERSION`s do not match.
```
/__w/pybind11/pybind11/tests/exo_planet_c_api.cpp:10:18: error: 'wrapGetLuggage' is a static definition in anonymous namespace; static is redundant here [readability-static-definition-in-anonymous-namespace,-warnings-as-errors]
   10 | static PyObject *wrapGetLuggage(PyObject *, PyObject *) { return PyUnicode_FromString("TODO"); }
      | ~~~~~~           ^
/__w/pybind11/pybind11/tests/exo_planet_c_api.cpp:14:20: error: 'ThisMethodDef' is a static definition in anonymous namespace; static is redundant here [readability-static-definition-in-anonymous-namespace,-warnings-as-errors]
   14 | static PyMethodDef ThisMethodDef[]
      | ~~~~~~             ^
/__w/pybind11/pybind11/tests/exo_planet_c_api.cpp:17:27: error: 'ThisModuleDef' is a static definition in anonymous namespace; static is redundant here [readability-static-definition-in-anonymous-namespace,-warnings-as-errors]
   17 | static struct PyModuleDef ThisModuleDef = {
      | ~~~~~~                    ^
```
…11/detail/type_caster_base.h, under the name `class_dunder_cpp_transporter()`
…objects, but do not include that magic method in docstring signatures.
Ralf W. Grosse-Kunstleve and others added 18 commits August 30, 2024 14:22
… `str` to `bytes`.

This avoids the unicode decode/encode roundtrips:

* More robust (no decode/encode errors).

* Minor runtime optimization.
…ype_info *"` -> `typeid(std::type_info).name()` (this IS a functional change).

This provides an extra layer of protection against C++ ABI mismatches:

* The first and most important layer is that the `PYBIND11_PLATFORM_ABI_ID`s must match between extensions.

* The second layer is that the `typeid(std::type_info).name()`s must match between extensions.
Copy link

google-cla bot commented Sep 1, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@rwgk rwgk marked this pull request as ready for review September 1, 2024 18:07
@rwgk rwgk merged commit 4841661 into google:main Sep 1, 2024
73 checks passed
@rwgk rwgk deleted the cpp_transporter_clif branch September 1, 2024 18:07
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.

1 participant