Skip to content

Commit cd1c9d4

Browse files
committed
Pure git merge --squash smart_holder (no manual interventions).
1 parent d8565ac commit cd1c9d4

File tree

73 files changed

+5801
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+5801
-28
lines changed

.codespell-ignore-lines

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ template <op_id id, op_type ot, typename L, typename R>
1212
template <detail::op_id id, detail::op_type ot, typename L, typename R, typename... Extra>
1313
class_ &def(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
1414
class_ &def_cast(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
15+
int valu;
16+
explicit movable_int(int v) : valu{v} {}
17+
movable_int(movable_int &&other) noexcept : valu(other.valu) { other.valu = 91; }
18+
explicit indestructible_int(int v) : valu{v} {}
19+
REQUIRE(hld.as_raw_ptr_unowned<zombie>()->valu == 19);
20+
REQUIRE(othr.valu == 19);
21+
REQUIRE(orig.valu == 91);
22+
(m.pass_valu, "Valu", "pass_valu:Valu(_MvCtor)*_CpCtor"),
23+
atyp_valu rtrn_valu() { atyp_valu obj{"Valu"}; return obj; }
24+
assert m.atyp_valu().get_mtxt() == "Valu"
25+
// valu(e), ref(erence), ptr or p (pointer), r = rvalue, m = mutable, c = const,
1526
@pytest.mark.parametrize("access", ["ro", "rw", "static_ro", "static_rw"])
1627
struct IntStruct {
1728
explicit IntStruct(int v) : value(v){};

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
branches:
88
- master
99
- stable
10+
- smart_holder
1011
- v*
1112

1213
permissions: read-all
@@ -87,6 +88,20 @@ jobs:
8788
# Extra ubuntu latest job
8889
- runs-on: ubuntu-latest
8990
python: '3.11'
91+
# Exercise PYBIND11_USE_SMART_HOLDER_AS_DEFAULT
92+
# with recent (or ideally latest) released Python version.
93+
- runs-on: ubuntu-latest
94+
python: '3.12'
95+
args: >
96+
-DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
97+
- runs-on: macos-13
98+
python: '3.12'
99+
args: >
100+
-DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
101+
- runs-on: windows-2022
102+
python: '3.12'
103+
args: >
104+
-DCMAKE_CXX_FLAGS="/DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT /GR /EHsc"
90105
exclude:
91106
# The setup-python action currently doesn't have graalpy for windows
92107
- python: 'graalpy-24.1'

.github/workflows/configure.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
branches:
88
- master
99
- stable
10+
- smart_holder
1011
- v*
1112

1213
permissions:

.github/workflows/emscripten.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
branches:
77
- master
88
- stable
9+
- smart_holder
910
- v*
1011

1112
concurrency:

.github/workflows/format.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
branches:
1111
- master
1212
- stable
13+
- smart_holder
1314
- "v*"
1415

1516
permissions:

.github/workflows/pip.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
branches:
88
- master
99
- stable
10+
- smart_holder
1011
- v*
1112
release:
1213
types:

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ repos:
7676
- id: mixed-line-ending
7777
- id: requirements-txt-fixer
7878
- id: trailing-whitespace
79+
exclude: \.patch?$
7980

8081
# Also code format the docs
8182
- repo: https://github.com/adamchainz/blacken-docs
@@ -90,6 +91,7 @@ repos:
9091
rev: "v1.5.5"
9192
hooks:
9293
- id: remove-tabs
94+
exclude: (^docs/.*|\.patch)?$
9395

9496
# Avoid directional quotes
9597
- repo: https://github.com/sirosen/texthooks

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,13 @@ set(PYBIND11_HEADERS
131131
include/pybind11/detail/common.h
132132
include/pybind11/detail/cpp_conduit.h
133133
include/pybind11/detail/descr.h
134+
include/pybind11/detail/dynamic_raw_ptr_cast_if_possible.h
134135
include/pybind11/detail/init.h
135136
include/pybind11/detail/internals.h
137+
include/pybind11/detail/struct_smart_holder.h
136138
include/pybind11/detail/type_caster_base.h
137139
include/pybind11/detail/typeid.h
140+
include/pybind11/detail/using_smart_holder.h
138141
include/pybind11/detail/value_and_holder.h
139142
include/pybind11/detail/exception_translation.h
140143
include/pybind11/attr.h
@@ -161,9 +164,11 @@ set(PYBIND11_HEADERS
161164
include/pybind11/operators.h
162165
include/pybind11/pybind11.h
163166
include/pybind11/pytypes.h
167+
include/pybind11/smart_holder.h
164168
include/pybind11/stl.h
165169
include/pybind11/stl_bind.h
166170
include/pybind11/stl/filesystem.h
171+
include/pybind11/trampoline_self_life_support.h
167172
include/pybind11/type_caster_pyobject_ptr.h
168173
include/pybind11/typing.h
169174
include/pybind11/warnings.h)

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
prune tests
2+
prune ubench
3+
include README_smart_holder.rst
24
recursive-include pybind11/include/pybind11 *.h
35
recursive-include pybind11 *.py
46
recursive-include pybind11 py.typed

README.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
.. start
1515
16+
.. Note::
17+
18+
This is the pybind11 **smart_holder** branch. Please refer to
19+
``README_smart_holder.rst`` for branch-specific information.
1620

1721
**pybind11** is a lightweight header-only library that exposes C++ types
1822
in Python and vice versa, mainly to create Python bindings of existing

0 commit comments

Comments
 (0)