Commit Graph

3340 Commits

Author SHA1 Message Date
Henry Schreiner
ec73bdaf1f
ci: skipping test for Windows Clang failure (#5062)
* ci: trying things for Windows Clang failure

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* WIP: try using older clang

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: skip broken test

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: try to skip test in tests

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix(tests): Prefer __version__ over MSVC

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* chore: avoid warning on Clang

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update tests/test_exceptions.py

* Update tests/test_exceptions.py

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-03-21 02:27:58 -04:00
Ralf W. Grosse-Kunstleve
10283c2ef4 Tracking ci.yml changes from master. 2024-02-20 12:29:51 -08:00
Ralf W. Grosse-Kunstleve
47422c53d0 Merge branch 'master' into sh_merge_master 2024-02-20 12:29:08 -08:00
Ralf W. Grosse-Kunstleve
35cb54295d
OMG: PYBIND11_INTERNALS_SH_DEF was defined the wrong way around since pybind/pybind11#3283 (merged 2021-09-20). (#5026) 2024-02-20 12:27:57 -08:00
dependabot[bot]
8b48ff878c
chore(deps): bump the actions group with 3 updates (#5024)
Bumps the actions group with 3 updates: [jwlawson/actions-setup-cmake](https://github.com/jwlawson/actions-setup-cmake), [actions/cache](https://github.com/actions/cache) and [pre-commit/action](https://github.com/pre-commit/action).


Updates `jwlawson/actions-setup-cmake` from 1.14 to 2.0
- [Release notes](https://github.com/jwlawson/actions-setup-cmake/releases)
- [Commits](https://github.com/jwlawson/actions-setup-cmake/compare/v1.14...v2.0)

Updates `actions/cache` from 3 to 4
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

Updates `pre-commit/action` from 3.0.0 to 3.0.1
- [Release notes](https://github.com/pre-commit/action/releases)
- [Commits](https://github.com/pre-commit/action/compare/v3.0.0...v3.0.1)

---
updated-dependencies:
- dependency-name: jwlawson/actions-setup-cmake
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: pre-commit/action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-13 20:50:51 -05:00
Henry Schreiner
0518bf9f9a
ci: ignore actions/checkout until v5 comes out 2024-02-13 18:36:39 -05:00
Henry Schreiner
e84d446d8e
ci: Ignore v1 updates for checkout (#5023)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-02-13 18:29:42 -05:00
pre-commit-ci[bot]
416f7a4410
chore(deps): update pre-commit hooks (#5018)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.1.9 → v0.2.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.9...v0.2.0)
- [github.com/sirosen/texthooks: 0.6.3 → 0.6.4](https://github.com/sirosen/texthooks/compare/0.6.3...0.6.4)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-02-05 23:07:31 -08:00
Pascal Thomet
768cebe17e
doc: add litgen to the automatic generators list (compiling.rst) (#5012)
* doc: add litgen to the automatic generators list (compiling.rst)

Added this:

[litgen]_ is an automatic python bindings generator with a focus on generating
documented and discoverable bindings: bindings will nicely reproduce the documentation
found in headers. It is is based on srcML (srcml.org), a highly scalable, multi-language
parsing tool with a developer centric approach. The API that you want to expose to python
must be C++14 compatible (but your implementation can use more modern constructs).

.. [litgen] https://pthom.github.io/litgen

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-01-28 09:10:03 -08:00
Ralf W. Grosse-Kunstleve
b8cf16143e Tracking ci.yml changes from master. 2024-01-16 21:11:06 -08:00
Ralf W. Grosse-Kunstleve
37c617c7fa Merge branch 'master' into sh_merge_master 2024-01-16 21:10:28 -08:00
Ralf W. Grosse-Kunstleve
869cc1ff08
install mingw-w64-${{matrix.env}}-python-scipy only for mingw64 (#5006) 2024-01-16 21:09:20 -08:00
Henry Schreiner
39e65e10d0
ci: group dependabot updates (#4986) 2024-01-13 15:28:39 -05:00
Huanchen Zhai
31b7e14052
bugfix: removing typing and duplicate `class_` for KeysView/ValuesView/ItemsView. Fix #4529 (#4985)
* remove typing for KeysView/ValuesView/ItemsView

* add tests for map view types
2024-01-13 11:07:36 -08:00
Ilya Lavrenov
aec6cc5406
fix(cmake): skip empty PYBIND11_PYTHON_EXECUTABLE_LAST for the first cmake run (#4856)
* fix(cmake): skip empty PYBIND11_PYTHON_EXECUTABLE_LAST for the first cmake run

* style: pre-commit fixes

* Update pybind11NewTools.cmake

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2024-01-08 08:40:41 -05:00
pre-commit-ci[bot]
f29def9ea4
chore(deps): update pre-commit hooks (#4994)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.1.6 → v0.1.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.6...v0.1.9)
- [github.com/pre-commit/mirrors-mypy: v1.7.1 → v1.8.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.7.1...v1.8.0)
- [github.com/PyCQA/pylint: v3.0.1 → v3.0.3](https://github.com/PyCQA/pylint/compare/v3.0.1...v3.0.3)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-01-01 19:25:58 -08:00
dependabot[bot]
b583336cf7
chore(deps): bump ilammy/msvc-dev-cmd from 1.12.1 to 1.13.0 (#4995)
Bumps [ilammy/msvc-dev-cmd](https://github.com/ilammy/msvc-dev-cmd) from 1.12.1 to 1.13.0.
- [Release notes](https://github.com/ilammy/msvc-dev-cmd/releases)
- [Commits](https://github.com/ilammy/msvc-dev-cmd/compare/v1.12.1...v1.13.0)

---
updated-dependencies:
- dependency-name: ilammy/msvc-dev-cmd
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-01 18:51:02 -08:00
Christoph Grüninger
976fea05a3
Fix Clazy warnings (#4988)
* stl.h: Use C++11 range-loops with const reference

This saves copy-ctor and dtor for non-trivial types by value
Found by clazy (range-loop-reference)

* test_smart_ptr.cpp cleanup

Introduce `pointer_set<T>`

https://github.com/boostorg/unordered/issues/139

> Based on the standard, the first move should leave a in a "valid but unspecified state";

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2023-12-29 21:59:47 -08:00
Ralf W. Grosse-Kunstleve
d2ac3f5c70
[smart_holder] Change throw_if_uninitialized_or_disowned_holder() to also show C++ type name. (#4977)
* Change `throw_if_uninitialized_or_disowned_holder()` to also show C++ type name.

* Fix pre-commit errors.
2023-12-15 19:29:22 -08:00
Ralf W. Grosse-Kunstleve
feed8b15b5 Tracking ci.yml changes from master. 2023-12-14 23:58:56 -08:00
Ralf W. Grosse-Kunstleve
0103ed11e8 Merge branch 'master' into sh_merge_master 2023-12-14 23:14:57 -08:00
dependabot[bot]
eeac2f4572
chore(deps): bump actions/upload-artifact from 3 to 4 (#4975)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-14 18:50:09 -08:00
dependabot[bot]
e8a43ea974
chore(deps): bump actions/download-artifact from 3 to 4 (#4976)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-14 18:46:13 -08:00
Victor Stinner
dc477fac0e
fix: Use PyObject_VisitManagedDict() of Python 3.13 (#4973)
* fix: Use PyObject_VisitManagedDict() of Python 3.13

Use PyObject_VisitManagedDict() and PyObject_ClearManagedDict() in
pybind11_traverse() and pybind11_clear() on Python 3.13 and newer.

* Add Python 3.13 CI

* tests: don't get numpy/scipy on 3.13 yet

* ci: move 3.13 to upstream

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2023-12-14 18:42:55 -08:00
Pol Mesalles
daea1130b4
fix(cmake): upgrade maximum supported CMake version to 3.27 (#4786)
* Upgrade maximum supported CMake version to 3.27 to fix warning with CMP0148 policy (#4785)

* Update `macos_brew_install_llvm` pipeline to use expected Python installation

* Fix `Python_EXECUTABLE` Cmake variable typo

* Apply suggestions from code review

* fix: use FindPython for CMake 3.18+ by default for pybind11's tests

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: fix issues with finding Python

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: also set executable on subdir tests

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix(cmake): correct logic for FindPython

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update ci.yml

* Revert "Update ci.yml"

This reverts commit 33798adf3f.

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2023-12-14 14:36:45 -05:00
Victor Stinner
7d538a4275
fix: make_static_property_type() (#4971)
Update make_static_property_type() to make it compatible with Python
3.13: set Py_TPFLAGS_MANAGED_DICT flag before calling PyType_Ready().
2023-12-14 06:36:25 -08:00
Ralf W. Grosse-Kunstleve
a5b0cdcb93
Add NOTE (#4968) 2023-12-12 13:16:47 -08:00
dependabot[bot]
68322895df
chore(deps): bump actions/setup-python from 4 to 5 (#4965)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-06 21:09:08 -08:00
Ralf W. Grosse-Kunstleve
5f094e3c1d Merge branch 'master' into sh_merge_master 2023-12-05 08:59:32 -08:00
pre-commit-ci[bot]
c1e06f5bf9
chore(deps): update pre-commit hooks (#4963)
updates:
- [github.com/pre-commit/mirrors-clang-format: v17.0.4 → v17.0.6](https://github.com/pre-commit/mirrors-clang-format/compare/v17.0.4...v17.0.6)
- [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6)
- [github.com/pre-commit/mirrors-mypy: v1.6.1 → v1.7.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.6.1...v1.7.1)
- [github.com/sirosen/texthooks: 0.6.2 → 0.6.3](https://github.com/sirosen/texthooks/compare/0.6.2...0.6.3)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-12-05 08:58:06 -08:00
Ralf W. Grosse-Kunstleve
3d39f2939a Similar to pybind/pybind11#4918: continue to be very specific. 2023-12-01 22:29:58 -08:00
Ralf W. Grosse-Kunstleve
d373f1641e Tracking ci.yml changes from master. 2023-12-01 22:00:51 -08:00
Ralf W. Grosse-Kunstleve
686783b3da Merge branch 'master' into sh_merge_master 2023-12-01 21:59:50 -08:00
Antoine Prouvost
a67d786571
fix(stl_bind): Enable bind_map with using declarations. (#4952)
* Enable `bind_map` with `using` declarations.

* style: pre-commit fixes

* Enable directives in bind_vector

* Add tests for bind_ and using directives

* style: pre-commit fixes

* Remove C++17 functions

* Fix test comment

* Add minimal user like map py test

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-11-29 12:56:25 -08:00
dependabot[bot]
4bb6163b4f
chore(deps): bump deadsnakes/action from 3.0.1 to 3.1.0 (#4951)
Bumps [deadsnakes/action](https://github.com/deadsnakes/action) from 3.0.1 to 3.1.0.
- [Release notes](https://github.com/deadsnakes/action/releases)
- [Commits](https://github.com/deadsnakes/action/compare/v3.0.1...v3.1.0)

---
updated-dependencies:
- dependency-name: deadsnakes/action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-27 15:37:43 -08:00
Ben Boeckel
dc9b39596d
pybind11.pc: use pcfiledir for relative destinations (#4830)
* pybind11.pc: use pcfiledir for relative destinations

If the datarootdir is absolute, just use the absolute path directly.
However, if it is relative, we can compute the prefix from the location
of the `.pc` file itself. This allows the install to be relocatable.

* chore: use 3.20's cmake_path if available

* style: pre-commit fixes

* Update CMakeLists.txt

---------

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-11-16 00:55:14 -05:00
Henry Schreiner
9591cfb0b8
fix(cmake): findpython issues and 3.12 support for pybind11_find_import (#4941)
* fix(cmake): findpython issues and 3.12 support for pybind11_find_import

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update pybind11NewTools.cmake

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2023-11-16 00:54:47 -05:00
Henry Schreiner
6831666f5c
ci: add more versions of numpy/scipy/pypy (#4714)
* ci: add more versions of numpy/scipy/pypy

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Apply suggestions from code review

* style: pre-commit fixes

* Update requirements.txt

* Update requirements.txt

* Apply suggestions from code review

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-11-16 00:52:05 -05:00
Henry Schreiner
6cf90e7286
fix(cmake): avoid really slow compile on emscripten (#4642)
* fix: avoid really slow compile on emscripten

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update tools/pybind11Common.cmake

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2023-11-16 00:50:15 -05:00
Henry Schreiner
b389ae77cb
chore: update changelog script for categories (#4942) 2023-11-15 18:59:07 -05:00
Ralf W. Grosse-Kunstleve
c6e71cf71c Merge branch 'master' into smart_holder 2023-11-08 13:04:09 -08:00
Ralf W. Grosse-Kunstleve
e250155afa
Fix a long-standing bug in the handling of Python multiple inheritance (#4762)
* Equivalent of 5718e4d080

* Resolve clang-tidy errors.

* Moving test_PPCCInit() first changes the behavior!

* Resolve new Clang dev C++11 errors:

```
The CXX compiler identification is Clang 17.0.0
```

```
pytypes.h:1615:23: error: identifier '_s' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator]
```

```
cast.h:1380:26: error: identifier '_a' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator]
```

* Resolve gcc 4.8.5 error:

```
pytypes.h:1615:12: error: missing space between '""' and suffix identifier
```

* Specifically exclude `__clang__`

* Snapshot of debugging code (does NOT pass pre-commit checks).

* Revert "Snapshot of debugging code (does NOT pass pre-commit checks)."

This reverts commit 1d4f9ff263.

* [ci skip] Order Dependence Demo

* Revert "[ci skip] Order Dependence Demo"

This reverts commit d37b5409d4.

* One way to deal with the order dependency issue. This is not the best way, more like a proof of concept.

* Move test_PC() first again.

* Add `all_type_info_add_base_most_derived_first()`, use in `all_type_info_populate()`

* Revert "One way to deal with the order dependency issue. This is not the best way, more like a proof of concept."

This reverts commit eb09c6c1b9.

* clang-tidy fixes (automatic)

* Add `is_redundant_value_and_holder()` and use to avoid forcing `__init__` overrides when they are not needed.

* Streamline implementation and avoid unsafe `reinterpret_cast<instance *>()` introduced with PR #2152

The `reinterpret_cast<instance *>(self)` is unsafe if `__new__` is mocked,
which was actually found in the wild: the mock returned `None` for `self`.
This was inconsequential because `inst` is currently cast straight back to
`PyObject *` to compute `all_type_info()`, which is empty if `self` is not
a pybind11 `instance`, and then `inst` is never dereferenced. However, the
unsafe detour through `instance *` is easily avoided and the updated
implementation is less prone to accidents while debugging or refactoring.

* Fix actual undefined behavior exposed by previous changes.

It turns out the previous commit message is incorrect, the `inst` pointer is actually dereferenced, in the `value_and_holder` ctor here:

f3e0602802/include/pybind11/detail/type_caster_base.h (L262-L263)

```
259     // Main constructor for a found value/holder:
260     value_and_holder(instance *i, const detail::type_info *type, size_t vpos, size_t index)
261         : inst{i}, index{index}, type{type},
262           vh{inst->simple_layout ? inst->simple_value_holder
263                                  : &inst->nonsimple.values_and_holders[vpos]} {}
```

* Add test_mock_new()

* Experiment: specify indirect bases

* Revert "Experiment: specify indirect bases"

This reverts commit 4f90d85f9f.

* Add `all_type_info_check_for_divergence()` and some tests.

* Call `all_type_info_check_for_divergence()` also from `type_caster_generic::load_impl<>`

* Resolve clang-tidy error:

```
include/pybind11/detail/type_caster_base.h:795:21: error: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty,-warnings-as-errors]
                if (matching_bases.size() != 0) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
                    !matching_bases.empty()
```

* Revert "Resolve clang-tidy error:"

This reverts commit df27188dc6.

* Revert "Call `all_type_info_check_for_divergence()` also from `type_caster_generic::load_impl<>`"

This reverts commit 5f5fd6a68e.

* Revert "Add `all_type_info_check_for_divergence()` and some tests."

This reverts commit 0a9599f775.
2023-11-08 12:44:04 -08:00
Ralf W. Grosse-Kunstleve
b9c17cfcd9 Merge branch 'master' into smart_holder 2023-11-08 11:18:21 -08:00
Ralf W. Grosse-Kunstleve
2c35fde389
Fix refcount bug introduced with PR #4916. (#4927)
https://github.com/pybind/pybind11/pull/4916/files#r1387035547
2023-11-08 11:16:10 -08:00
Ralf W. Grosse-Kunstleve
124b62a087 Merge branch 'master' into sh_merge_master 2023-11-07 23:44:24 -08:00
Henry Schreiner
c758b81f3b
chore: move to ruff-format (#4912)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2023-11-07 23:42:54 -08:00
pre-commit-ci[bot]
0a974fed54
chore(deps): update pre-commit hooks (#4923)
updates:
- [github.com/pre-commit/mirrors-clang-format: v17.0.3 → v17.0.4](https://github.com/pre-commit/mirrors-clang-format/compare/v17.0.3...v17.0.4)
- [github.com/astral-sh/ruff-pre-commit: v0.1.2 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.2...v0.1.4)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-11-07 22:59:52 -08:00
Ivor Wanders
e5ce9631b1
[smart_holder] Unique ptr deleter roundtrip tests and fix (#4921)
* Roundtrip through unique pointer with custom deleter.

Currently failing.

* Ensure the custom deleter is copied back to the unique pointer.

Feels like there's still a gap around the raw pointer flavour, but this at least
makes the unit test of the previous commit succeed.

* Add deleter roundtrip for const atyp.

Currently failing, custom deleter is lost.

* Fix storing deleter for const unique ptr.

Unit test from the previous commit passes.

* Remove SFINEA deleter assignment.

At the construction of the smart holder, it is either a del_fun, or a default constructed deleter, so this complexity is unnecessary.

* Clang format.

* Fixes for ci.

Clang 3.6 requires the extra constructors in the custom_deleter.

* fix(smart_holder): Loosen requirement on deleter to be default constructible.

And some other PR feedback.

* fix(smart_holder): Custom deleter in unit tests traces constructions.

* fix(smart_holder): Use pybind11_fail instead of assert.

* fix(smart_holder): Add unit tests for the default constructible deleter.

* fix(smart_holder): Use regex matching for deleter constructors in unit tests.
2023-11-07 22:58:24 -08:00
Ivor Wanders
e02fe001cd
fix(smart_holder): Use std::default_delete. (#4924)
Ensures `std::default_delete<T>` is used to look up the deleter for a type instead of `delete` directly.
2023-11-06 15:56:21 -08:00
cyyever
f2606930bf
Use newer PyCode API and other fixes (#4916)
* Use PyCode API

* style: pre-commit fixes

* Free locals

* Fix PY_VERSION_HEX check

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-11-05 14:08:32 -08:00