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

Tiny Proof Of Concept: type_fingerprint() to support safely passing C++ pointers between Python extensions. #4703

Closed
wants to merge 1 commit into from

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented Jun 16, 2023

Description

This PR is only to have a public record of the simple idea.

High-level idea: Pass C++ pointers via Python capsules between any wrapping system (SWIG, pybind11, nanobind, ..., manually written).

All those systems would have to standardize on

  • the same "finger print",

  • names for methods to request a Python capsule (e.g. __cpp_raw_ptr__, __cpp_unique_ptr__, __cpp_shared_ptr__).

Suggested changelog entry:

… C++ pointers between Python extensions.

High-level idea: Pass C++ pointers via Python capsules between *any* wrapping system (SWIG, pybind11, nanobind, ..., manually written).

All those systems would have to standardize on

* the same "finger print",

* names for methods to request the Python capsule (e.g. `__cpp_raw_ptr__`, `__cpp_unique_ptr__`, `__cpp_shared_ptr__`).
@rwgk
Copy link
Collaborator Author

rwgk commented Jun 16, 2023

Quick overview, mostly just because it was easy.

Input was logs_28611.zip

$ grep SKIPPED.*SHOW *.txt | sed 's/^[1-9][0-9]*_*//' | sed 's/\.txt:.*SHOW: /@/' | python3 ~/get_type_fingerprint_summary.py
NSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE _clang_libcpp_cxxabi1002
  3.10___macos-latest___x64
  3.10___macos-latest___x64
  3.10___macos-latest___x64
  3.11___macos-latest___x64
  3.11___macos-latest___x64
  3.11___macos-latest___x64
  3.6___macos-latest___x64
  3.6___macos-latest___x64
  3.6___macos-latest___x64
  3.9___macos-latest___x64
  3.9___macos-latest___x64
  3.9___macos-latest___x64
  macos-latest___brew_install_llvm
  pypy-3.7___macos-latest___x64
  pypy-3.7___macos-latest___x64
  pypy-3.7___macos-latest___x64
  pypy-3.8___macos-latest___x64
  pypy-3.8___macos-latest___x64
  pypy-3.8___macos-latest___x64
  pypy-3.9___macos-latest___x64
  pypy-3.9___macos-latest___x64
  pypy-3.9___macos-latest___x64
NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE _clang_libstdcpp_cxxabi1002
  3___Clang_11___C++20___x64
  3___Clang_12___C++20___x64
  3___Clang_13___C++20___x64
  3___Clang_14___C++20___x64
  3___Clang_15___C++20___x64
  3___Clang_5___C++14___x64
  3___Clang_dev___C++11___x64
NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE _gcc_libstdcpp_cxxabi1013
  3.10___ubuntu-20.04___x64
  3.10___ubuntu-20.04___x64
  3.10___ubuntu-20.04___x64
  3.11___ubuntu-20.04___x64
  3.11___ubuntu-20.04___x64
  3.11___ubuntu-20.04___x64
  3.11__deadsnakes____x64
  3.6___ubuntu-20.04___x64_-DPYBIND11_FINDPYTHON=ON_-DCMA
  3.6___ubuntu-20.04___x64_-DPYBIND11_FINDPYTHON=ON_-DCMA
  3.6___ubuntu-20.04___x64_-DPYBIND11_FINDPYTHON=ON_-DCMA
  3.7___Debian___x86____Install
  3.9-dbg__deadsnakes____Valgrind___x64
  3.9-dbg__deadsnakes____Valgrind___x64
  3.9___ubuntu-20.04___x64
  3.9___ubuntu-20.04___x64
  3.9___ubuntu-20.04___x64
  3___almalinux8___x64
  pypy-3.7___ubuntu-20.04___x64
  pypy-3.7___ubuntu-20.04___x64
  pypy-3.7___ubuntu-20.04___x64
  pypy-3.8___ubuntu-20.04___x64_-DPYBIND11_FINDPYTHON=ON
  pypy-3.8___ubuntu-20.04___x64_-DPYBIND11_FINDPYTHON=ON
  pypy-3.8___ubuntu-20.04___x64_-DPYBIND11_FINDPYTHON=ON
  pypy-3.9___ubuntu-20.04___x64
  pypy-3.9___ubuntu-20.04___x64
  pypy-3.9___ubuntu-20.04___x64
NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE _gcc_libstdcpp_cxxabi1016
  3.10___CUDA_11.7___Ubuntu_22.04
  3___almalinux9___x64
NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE _icc_libstdcpp_cxxabi1010
  3___ICC_latest___x64
  3___ICC_latest___x64
NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE _mingw_libstdcpp_cxxabi1018
  3___windows-latest___mingw32
  3___windows-latest___mingw32
  3___windows-latest___mingw32
  3___windows-latest___mingw64
  3___windows-latest___mingw64
  3___windows-latest___mingw64
Ss _gcc_libstdcpp_cxxabi1002
  3___centos7___x64
class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > _msvc_debug
  3.10___windows-2022___x64
  3.10___windows-2022___x64
  3.10___windows-2022___x64
  3.10___windows-latest___clang-latest
  3.11___windows-2022___x64
  3.11___windows-2022___x64
  3.11___windows-2022___x64
  3.6___MSVC_2019___x86
  3.6___windows-2019___x64_-DPYBIND11_FINDPYTHON=ON
  3.6___windows-2019___x64_-DPYBIND11_FINDPYTHON=ON
  3.6___windows-2019___x64_-DPYBIND11_FINDPYTHON=ON
  3.6___windows-2022___x64
  3.6___windows-2022___x64
  3.6___windows-2022___x64
  3.7___MSVC_2019___x86_-DCMAKE_CXX_STANDARD=14
  3.8___MSVC_2019__Debug____x86_-DCMAKE_CXX_STANDARD=17
  3.8___MSVC_2019___x86_-DCMAKE_CXX_STANDARD=17
  3.9___MSVC_2019__Debug____x86_-DCMAKE_CXX_STANDARD=20
  3.9___MSVC_2019___x86_-DCMAKE_CXX_STANDARD=20
  3.9___MSVC_2022_C++20___x64
  3.9___windows-2019___x64
  3.9___windows-2019___x64
  3.9___windows-2019___x64
  3.9___windows-2022___x64
  3.9___windows-2022___x64
  3.9___windows-2022___x64
  pypy-3.7___windows-2022___x64
  pypy-3.7___windows-2022___x64
  pypy-3.7___windows-2022___x64
  pypy-3.8___windows-2022___x64
  pypy-3.8___windows-2022___x64
  pypy-3.8___windows-2022___x64
  pypy-3.9___windows-2022___x64
  pypy-3.9___windows-2022___x64
  pypy-3.9___windows-2022___x64

@rwgk rwgk closed this Jun 16, 2023
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