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

[smart_holder] Conversions between Python's native (stdlib) enum types and C++ enums. #4349

Closed
wants to merge 11 commits into from

Commits on Nov 19, 2022

  1. Transfer PR pybind#4329 from master to smart_holder branch, STEP 1.

    The patch .rej below are resolved, but THIS STATE DOES NOT BUILD:
    
    ```
    clang++ -o pybind11/tests/test_constants_and_functions.os -c -std=c++17 -fPIC -fvisibility=hidden -O0 -g -Wall -Wextra -Wconversion -Wcast-qual -Wdeprecated -Wundef -Wnon-virtual-dtor -Wunused-result -Werror -isystem /usr/include/python3.10 -isystem /usr/include/eigen3 -DPYBIND11_STRICT_ASSERTS_CLASS_HOLDER_VS_TYPE_CASTER_MIX -DPYBIND11_ENABLE_TYPE_CASTER_ODR_GUARD_IF_AVAILABLE -DPYBIND11_TEST_BOOST -Ipybind11/include -I/usr/local/google/home/rwgk/forked/pybind11/include -I/usr/local/google/home/rwgk/clone/pybind11/include /usr/local/google/home/rwgk/forked/pybind11/tests/test_constants_and_functions.cpp
    In file included from /usr/local/google/home/rwgk/forked/pybind11/tests/test_constants_and_functions.cpp:11:
    In file included from /usr/local/google/home/rwgk/forked/pybind11/tests/pybind11_tests.h:3:
    In file included from /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/eval.h:14:
    /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/pybind11.h:1781:9: error: static_assert failed due to requirement '!holder_is_smart_holder == type_caster_type_is_type_caster_base_subtype' "py::class_ holder vs type_caster mismatch: missing PYBIND11_TYPE_CASTER_BASE_HOLDER(T, ...) or collision with custom py::detail::type_caster<T>?"
            static_assert(!holder_is_smart_holder == type_caster_type_is_type_caster_base_subtype,
            ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/pybind11.h:2460:11: note: in instantiation of function template specialization 'pybind11::class_<MyEnum>::class_<>' requested here
            : class_<Type>(scope, name, extra...), m_base(*this, scope) {
              ^
    /usr/local/google/home/rwgk/forked/pybind11/tests/test_constants_and_functions.cpp:106:5: note: in instantiation of function template specialization 'pybind11::enum_<MyEnum>::enum_<>' requested here
        py::enum_<MyEnum>(m, "MyEnum")
        ^
    1 error generated.
    ```
    
    ________
    
    ```
    rwgk.c.googlers.com:~/forked/pybind11 $ patch -p 1 < ~/native_enum_git_diff_master_2022-11-19+131942.patch
    patching file .github/workflows/python312.yml
    patching file CMakeLists.txt
    Hunk #1 FAILED at 111.
    Hunk #2 succeeded at 138 (offset 5 lines).
    1 out of 2 hunks FAILED -- saving rejects to file CMakeLists.txt.rej
    patching file include/pybind11/cast.h
    Hunk #1 FAILED at 12.
    Hunk #2 succeeded at 78 (offset 30 lines).
    Hunk #3 succeeded at 1173 (offset 41 lines).
    1 out of 3 hunks FAILED -- saving rejects to file include/pybind11/cast.h.rej
    patching file include/pybind11/detail/abi_platform_id.h
    patching file include/pybind11/detail/cross_extension_shared_state.h
    patching file include/pybind11/detail/internals.h
    Hunk #1 FAILED at 16.
    Hunk #2 succeeded at 109 (offset 1 line).
    Hunk #3 FAILED at 203.
    Hunk #4 succeeded at 398 (offset 11 lines).
    Hunk #5 succeeded at 457 (offset 11 lines).
    2 out of 5 hunks FAILED -- saving rejects to file include/pybind11/detail/internals.h.rej
    patching file include/pybind11/detail/native_enum_data.h
    patching file include/pybind11/detail/type_map.h
    patching file include/pybind11/embed.h
    patching file include/pybind11/native_enum.h
    patching file include/pybind11/pybind11.h
    Hunk #1 FAILED at 12.
    Hunk #2 succeeded at 1269 (offset 1 line).
    Hunk #3 succeeded at 2457 (offset 255 lines).
    1 out of 3 hunks FAILED -- saving rejects to file include/pybind11/pybind11.h.rej
    patching file include/pybind11/pytypes.h
    patching file tests/CMakeLists.txt
    Hunk #1 succeeded at 160 (offset 18 lines).
    patching file tests/conftest.py
    patching file tests/extra_python_package/test_files.py
    Hunk #2 FAILED at 47.
    1 out of 2 hunks FAILED -- saving rejects to file tests/extra_python_package/test_files.py.rej
    patching file tests/test_embed/test_interpreter.cpp
    patching file tests/test_enum.cpp
    patching file tests/test_enum.py
    patching file tests/test_native_enum.cpp
    patching file tests/test_native_enum.py
    ```
    Ralf W. Grosse-Kunstleve committed Nov 19, 2022
    Configuration menu
    Copy the full SHA
    04557ca View commit details
    Browse the repository at this point in the history

Commits on Nov 20, 2022

  1. Make smart_holder code compatible with type_caster_enum_type

    Ralf W. Grosse-Kunstleve committed Nov 20, 2022
    Configuration menu
    Copy the full SHA
    a45bb61 View commit details
    Browse the repository at this point in the history
  2. Fix if condition guarding `Unable to cast native enum type to refer…

    …ence`
    Ralf W. Grosse-Kunstleve committed Nov 20, 2022
    Configuration menu
    Copy the full SHA
    3ec457a View commit details
    Browse the repository at this point in the history
  3. WIP native_enum_add_to_parent

    Ralf W. Grosse-Kunstleve committed Nov 20, 2022
    Configuration menu
    Copy the full SHA
    9e940e7 View commit details
    Browse the repository at this point in the history

Commits on Nov 21, 2022

  1. PYBIND11_SILENCE_MSVC_C4127

    Ralf W. Grosse-Kunstleve committed Nov 21, 2022
    Configuration menu
    Copy the full SHA
    f344bfa View commit details
    Browse the repository at this point in the history

Commits on Dec 5, 2022

  1. Merge branch 'smart_holder' into native_enum_sh

    Ralf W. Grosse-Kunstleve committed Dec 5, 2022
    Configuration menu
    Copy the full SHA
    41cf4ce View commit details
    Browse the repository at this point in the history

Commits on Dec 6, 2022

  1. Merge branch 'smart_holder' into native_enum_sh

    Ralf W. Grosse-Kunstleve committed Dec 6, 2022
    Configuration menu
    Copy the full SHA
    b5f8cde View commit details
    Browse the repository at this point in the history

Commits on Jan 4, 2023

  1. Merge branch 'smart_holder' into native_enum_sh

    Ralf W. Grosse-Kunstleve committed Jan 4, 2023
    Configuration menu
    Copy the full SHA
    78bfc94 View commit details
    Browse the repository at this point in the history
  2. Transfer upstream.yml/python312.yml changes from PR pybind#4397

    Ralf W. Grosse-Kunstleve committed Jan 4, 2023
    Configuration menu
    Copy the full SHA
    10253a1 View commit details
    Browse the repository at this point in the history
  3. clang-tidy (clang 15) auto-fix

    Ralf W. Grosse-Kunstleve committed Jan 4, 2023
    Configuration menu
    Copy the full SHA
    8690a88 View commit details
    Browse the repository at this point in the history

Commits on Feb 17, 2023

  1. Merge branch 'smart_holder' into native_enum_sh

    Ralf W. Grosse-Kunstleve committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    613b46e View commit details
    Browse the repository at this point in the history