Commit Graph

3496 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve
2e6d06d3f4
Merge branch 'master' into sh_merge_master 2024-11-10 12:45:42 -08:00
Ralf W. Grosse-Kunstleve
a90e2af88d
Factor out pybind11/conduit/pybind11_platform_abi_id.h (#5375)
* Factor out pybind11/compat/wrap_include_python_h.h

* Fixes to resolve tests_packaging failures.

* Factor out pybind11/compat/pybind11_platform_abi_id.h

* Add pybind11/compat/README.txt and a couple source code comments.

* Minor changes to comments.

* Factor out pybind11/compat/pybind11_conduit_v1.h

* Add long comment to pybind11/compat/pybind11_conduit_v1.h

* Add pybind11/compat/README.txt to wheels.

* Add `-fno-exceptions` to compiler options for exo_planet_c_api

* 1. Move `target_compile_options()` into loop over test targets, in case the `"exo_planet_c_api"` target does not exist.  2. Add `-fno-exceptions` option also for `NVHPC`.  3. Also check for `__cpp_exceptions` in exo_planet_c_api.cpp.

* 1. Fix accident (forgot to undo temporary change).  2. Special-case __EMSCRIPTEN__ in exo_planet_c_api.cpp

* Give up on compiling exo_planet_c_api.cpp with MSVC `/EHs-c-`:

There was one trouble maker (all other jobs worked):

Visual Studio 15 2017:

```
cl : Command line warning D9025: overriding '/EHc' with '/EHc-' [C:\projects\pybind11\tests\exo_planet_c_api.vcxproj]
...
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xlocale(319): error C2220: warning treated as error - no 'object' file generated [C:\projects\pybind11\tests\exo_planet_c_api.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xlocale(319): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
```

* Move pybind11/compat to pybind11/conduit as suggested by @henryiii:

https://github.com/pybind/pybind11/pull/5375#pullrequestreview-2329006001
2024-11-10 12:17:35 -08:00
Isuru Fernando
ec9c26817f
Fix MSVC MT/MD incompatibility in PYBIND11_BUILD_ABI (#4953)
* Fix MSVC MT/MD incompatibility in PYBIND11_BUILD_ABI

* Update comment about which PR

* Use msvc major version

* Use _MSC_VER/100

* Fix figuring out MD vs MT

* Add some test runs

* Skip one test

* Fix preprocessor

* simplify code

* fix if

* support only msvc 19

* Fold in changes from experimental PR #5411. Polish error messages.

* Remove `&& defined(_DLL)` (TBD: is it needed? but what is correct?)

* Fix MT vs MD

* Add a couple comments, based on https://github.com/pybind/pybind11/pull/4953#issuecomment-2435138593 (posted by @isuruf).

* Replace misleading comment: NVHPC is NOT outdated.

* Update include/pybind11/detail/internals.h

Co-authored-by: Robert Maynard <robertjmaynard@gmail.com>

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgkio@gmail.com>
Co-authored-by: Robert Maynard <robertjmaynard@gmail.com>
2024-11-10 09:24:29 -08:00
Elliott Sales de Andrade
037310ea8a
Use std::unique_ptr in pybind11_getbuffer (#5435)
* Use std::unique_ptr in pybind11_getbuffer

* Move final assignment later
2024-11-07 21:58:24 -08:00
Ralf W. Grosse-Kunstleve
85209ea0ce
clang-format auto-fix (consequence of master PR #5432). 2024-11-07 10:05:12 -08:00
Ralf W. Grosse-Kunstleve
dca5623226
Merge branch 'master' into sh_merge_master 2024-11-07 09:35:12 -08:00
vfdev
ce2f005594
Fixed data race in all_type_info in free-threading mode (#5419)
* Fix data race all_type_info_populate in free-threading mode
Description:
- fixed data race all_type_info_populate in free-threading mode
- added test

For example, we have 2 threads entering `all_type_info`.
Both enter `all_type_info_get_cache`` function and
there is a first one which inserts a tuple (type, empty_vector) to the map
and second is waiting. Inserting thread gets the (iter_to_key, True) and non-inserting thread
after waiting gets (iter_to_key, False).
Inserting thread than will add a weakref and will then call into `all_type_info_populate`.
However, non-inserting thread is not entering `if (ins.second) {` clause and
returns `ins.first->second;`` which is just empty_vector.
Finally, non-inserting thread is failing the check in `allocate_layout`:
```c++
if (n_types == 0) {
    pybind11_fail(
        "instance allocation failed: new instance has no pybind11-registered base types");
}
```

* style: pre-commit fixes

* Addressed PR comments

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-11-07 09:32:09 -08:00
Tim Stumbaugh
f46f5be4fa
Fix incorrect link syntax in upgrade guide (#5434)
Looks like some markdown spilled into our restructured text
2024-11-06 11:21:33 -08:00
pre-commit-ci[bot]
5c07feef2f
chore(deps): update pre-commit hooks (#5432)
* chore(deps): update pre-commit hooks

updates:
- [github.com/pre-commit/mirrors-clang-format: v18.1.8 → v19.1.3](https://github.com/pre-commit/mirrors-clang-format/compare/v18.1.8...v19.1.3)
- [github.com/astral-sh/ruff-pre-commit: v0.6.3 → v0.7.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.3...v0.7.2)
- [github.com/pre-commit/mirrors-mypy: v1.11.2 → v1.13.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.11.2...v1.13.0)
- [github.com/pre-commit/pre-commit-hooks: v4.6.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.6.0...v5.0.0)
- [github.com/adamchainz/blacken-docs: 1.18.0 → 1.19.1](https://github.com/adamchainz/blacken-docs/compare/1.18.0...1.19.1)
- [github.com/mgedmin/check-manifest: 0.49 → 0.50](https://github.com/mgedmin/check-manifest/compare/0.49...0.50)
- [github.com/PyCQA/pylint: v3.2.7 → v3.3.1](https://github.com/PyCQA/pylint/compare/v3.2.7...v3.3.1)
- [github.com/python-jsonschema/check-jsonschema: 0.29.2 → 0.29.4](https://github.com/python-jsonschema/check-jsonschema/compare/0.29.2...0.29.4)

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-11-06 11:19:25 -08:00
Ralf W. Grosse-Kunstleve
3b35ce475f
Merge branch 'master' into sh_merge_master 2024-11-05 10:20:12 -08:00
Elliott Sales de Andrade
bc041de0db
Fix buffer protocol implementation (#5407)
* Fix buffer protocol implementation

According to the buffer protocol, `ndim` is a _required_ field [1], and
should always be set correctly. Additionally, `shape` should be set if
flags includes `PyBUF_ND` or higher [2]. The current implementation only
set those fields if flags was `PyBUF_STRIDES`.

[1] https://docs.python.org/3/c-api/buffer.html#request-independent-fields
[2] https://docs.python.org/3/c-api/buffer.html#shape-strides-suboffsets

* Apply suggestions from review

* Obey contiguity requests for buffer protocol

If a contiguous buffer is requested, and the underlying buffer isn't,
then that should raise. This matches NumPy behaviour if you do something
like:
```
struct.unpack_from('5d', np.arange(20.0)[::4])  # Raises for contiguity
```

Also, if a buffer is contiguous, then it can masquerade as a
less-complex buffer, either by dropping strides, or even pretending to
be 1D. This matches NumPy behaviour if you do something like:
```
a = np.full((3, 5), 30.0)
struct.unpack_from('15d', a)  # --> Produces 1D tuple from 2D buffer.
```

* Handle review comments

* Test buffer protocol against NumPy

* Also check PyBUF_FORMAT results
2024-11-05 10:14:24 -08:00
Michael Šimáček
75e48c5f95
Skip transient tests on GraalPy (#5422) 2024-10-25 08:28:15 -07:00
Francesco Ballarin
f7e14e985b
Address regression introduced in #5381 (#5396)
* Incomplete attempt to address regression introduced in #5381

* style: pre-commit fixes

* Revert "style: pre-commit fixes"

This reverts commit 9d107d2f75.

* Revert "Incomplete attempt to address regression introduced in #5381"

This reverts commit 8cf1cdbc96.

* Simpler fix for the regression introduced in #5381

* style: pre-commit fixes

* Added if constexpr workaround

This can probably be done better but at least this is a start.

* style: pre-commit fixes

* Replace if constexpr with template struct

if constexpr was not added until C++ 17.
I think this should do the same thing as before.

* style: pre-commit fixes

* Made comment clearer

* Added test cases

* style: pre-commit fixes

* Fixed is_same_or_base_of reference

* style: pre-commit fixes

* Added static assert messages

* style: pre-commit fixes

* Replaced typedef with using

* style: pre-commit fixes

* Back out `ForwardClassPtr` (to be discussed separately). Tested locally with clang-tidy.

* Shuffle new `static_assert()` and leave error messages blank (they are more distracting than helpful here).

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: gentlegiantJGC <gentlegiantJGC@users.noreply.github.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2024-10-12 11:19:50 -07:00
Ralf W. Grosse-Kunstleve
d8b1541168
Merge branch 'master' into sh_merge_master 2024-10-11 20:40:52 -07:00
cyyever
077e49fcd6
Export libc++ exceptions (#5390)
* Export libc++ exceptions

* Remove emscripten limit

* Remove __apple_build_version__ condition from PYBIND11_EXPORT_EXCEPTION

* Add a comment
2024-10-11 20:36:41 -07:00
Boris Dalstein
f2907651fa
Fix #5399: iterator increment operator does not skip first item (#5400)
* Fix #5399: iterator increment operator does not skip first item

* Fix postfix increment operator: init() must be called before copying *this
2024-10-11 20:33:13 -07:00
Ralf W. Grosse-Kunstleve
973c1e06c1
Merge branch 'master' into sh_merge_master 2024-10-08 11:22:45 -07:00
Thomas Köppe
af67e87393
docs/advanced A document about deadlock potential with C++ statics (#5394)
* [docs/advanced] A document about deadlock potential with C++ statics

* [docs/advanced] Refer to deadlock.md from misc.rst

* [docs/advanced] Fix tables in deadlock.md

* Use :ref:`deadlock-reference-label`

* Revert "Use :ref:`deadlock-reference-label`"

This reverts commit e5734d275f.

* Add simple references to docs/advanced/deadlock.md filename. (Maybe someone can work on clickable links later.)

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2024-10-08 10:51:20 -07:00
Paul-Edouard Sarlin
56e69a20a5
Print key in KeyError in map.__getitem__/__delitem__ (#5397)
* Print key in map.getitem/delitem KeyError

* Add tests

* Fix tests

* Make robust

* Make clang-tidy happy

* Return a Python str

* Show beginning and end of the message

* Avoid implicit conversion

* Split out `format_message_key_error_key_object()` to reduce amount of templated code.

* Use `"✄✄✄"` instead of `"..."`

Also rename variable to `cut_length`, to not get into even/odd issues with the meaning of "half".

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2024-10-08 10:49:35 -07:00
Michael Šimáček
cfd222ebdf
Skip GC-dependent tests on GraalPy (#5401) 2024-10-08 10:44:24 -07:00
Ralf W. Grosse-Kunstleve
98ec25c6af
Merge branch 'master' into sh_merge_master 2024-10-07 14:15:07 -07:00
Michael Šimáček
c4a05f9344
Add support for GraalPy (#5380)
* Initial support for GraalPy

* Mark tests that currently fail on GraalPy with xfail

* Add graalpy to CI

* Limit test deps on graalpy to available binary wheels

* Skip cmake test installed_function on GraalPy

CMake won't find libpython on GraalPy, it either fails or silently picks
CPython's libpython.

* Factor out setting function docstrings into a macro

* Try to narrow down skipped tests
2024-10-07 14:12:04 -07:00
Ralf W. Grosse-Kunstleve
43d6bfce7d
Merge branch 'master' into smart_holder 2024-09-25 13:31:19 +00:00
gentlegiantJGC
7e418f4924
Allow subclasses of py::args and py::kwargs (#5381)
* Allow subclasses of py::args and py::kwargs

The current implementation does not allow subclasses of args or kwargs.
This change allows subclasses to be used.

* Added test case

* style: pre-commit fixes

* Added missing semi-colons

* style: pre-commit fixes

* Added handle_type_name

* Moved classes outside of function

* Added namespaces

* style: pre-commit fixes

* Refactored tests

Added more tests and moved tests to more appropriate locations.

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-09-24 10:28:22 -07:00
Hintay
1f8b4a7f1a
fix(cmake): NO_EXTRAS in pybind11_add_module function partially working (#5378) 2024-09-19 11:24:35 -04:00
dependabot[bot]
ad9fd39e14
chore(deps): bump pypa/cibuildwheel in the actions group (#5376)
Bumps the actions group with 1 update: [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel).


Updates `pypa/cibuildwheel` from 2.20 to 2.21
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v2.20...v2.21)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-17 10:19:17 -07:00
vfdev
1d9483ff73
Added exception translator specific mutex used with try_translate_exceptions (#5362)
* Added exception translator specific mutex used with try_translate_exceptions
Fixes #5346

* - Replaced with_internals_for_exception_translator by with_exception_translators
- Incremented PYBIND11_INTERNALS_VERSION
- Added a test

* style: pre-commit fixes

* Fixed formatting and added explicit to ctors

* Addressed PR review comments

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-09-17 09:47:20 -07:00
Bobby R. Bruce
a7910be630
Add warn disable for GGC 12 bound checking error (#5355)
Issue: #5224

The `internals.registered_types_py...` line in pybind11.h triggers a
false-positive bounds checking warning in GCC 12.

This is discussed in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115824.

The workaround implemented is taken from suggestions then refactored to
use the `PYBIND11_WARNING_PUSH` and `PYBIND11_WARNING_POP` MACROS.
2024-09-14 23:51:50 -07:00
Henry Schreiner
0cf3a0f7b5
ci: PyPI attestations (#5374) 2024-09-13 20:21:43 -04:00
Henry Schreiner
5b7c0b04b9
docs: update changelog for 2.13.6 (#5372)
* docs: update changelog for 2.13.6

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

* docs: mention supported versions

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-09-13 16:59:50 -04:00
Ralf W. Grosse-Kunstleve
a3b300eb90 Merge branch 'master' into sh_merge_master 2024-09-12 22:06:58 -07:00
Ralf W. Grosse-Kunstleve
ef5a9560bb
Enable type-safe interoperability between different independent Python/C++ bindings systems. (#5296)
* `self.__cpp_transporter__()` proof of concept: Enable passing C++ pointers across extensions even if the `PYBIND11_INTERNALS_VERSION`s do not match.

* Include cleanup (mainly to resolve PyPy build failures).

* Fix clang-tidy errors.

* Resolve `error: extra

* factor out platform_abi_id.h from internals.h (no functional changes)

* factor out internals_version.h from internals.h (no functional changes)

* Update CMakeLists.txt, tests/extra_python_package/test_files.py

* Revert "factor out internals_version.h from internals.h (no functional changes)"

This reverts commit 3ccea8cd43.

* Remove internals_version.h from CMakeLists.txt, tests/extra_python_package/test_files.py

* `.__cpp_transporter__()` implementation: compare `pybind11_platform_abi_id`, `cpp_typeid_name`

* Add PremiumTraveler

* Rename test_cpp_transporter_traveler_type.h -> test_cpp_transporter_traveler_types.h

* Expand tests: `PremiumTraveler`, `get_points()`

* Shuffle order of tests (no real changes).

* Move `__cpp_transporter__` lambda to `py::cpp_transporter()` regular function.

* Use `type_caster_generic::load(self)` instead of `cast<T *>(self)`

* Pass `const std::type_info *` via `py::capsule` (instead of `cpp_typeid_name`).

* Make platform_abi_id.h completely stand-alone.

* rename exo_planet.cpp -> exo_planet_pybind11.cpp

* Add exo_planet_c_api.cpp (incomplete).

* Fix silly oversight (wrong filename in `#include`).

* Resolve clang-tidy errors:

```
/__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 = {
      | ~~~~~~                    ^
```

* Implement exo_planet_c_api GetLuggage(), GetPoints()

* Move new code from test_cpp_transporter_traveler_bindings.h to pybind11/detail/type_caster_base.h, under the name `class_dunder_cpp_transporter()`

* Fix oversight.

* Unconditionally add `__cpp_transporter__` method to all `py::class_` objects, but do not include that magic method in docstring signatures.

* Back out pybind11/detail/platform_abi_id.h for now. Maximizing reusability can be handled separately, later.

* Small cleanup.

* Restore and add to `test_call_cpp_transporter_*()`

* Ensure https://github.com/pybind/pybind11/issues/3788 does not bite again.

* `class_dunder_cpp_transporter()`: replace `obj.cast<std::string>()` with `std::string(obj)`

* Add (simple) copyright notices in all newly added files.

* Globally replace cpp_transporter with cpp_conduit

* style: pre-commit fixes

* IWYU fixes

* Rename `class_dunder_cpp_conduit()` -> `cpp_conduit_method()`

* Change `pybind11_platform_abi_id`, `pointer_kind` argument types from `str` to `bytes`.

This avoids the unicode decode/encode roundtrips:

* More robust (no decode/encode errors).

* Minor runtime optimization.

* Systematically rename `cap_cpp_type_info` -> `cpp_type_info_capsule` (no functional changes).

* Systematically replace `cpp_type_info_capsule` `name`: `"const std::type_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.

* Fix sort order accident in tests/CMakeLists.txt

* Apply suggestions from code review

Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>

* style: pre-commit fixes

* refactor: rename to _pybind_conduit_v1_

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

* Add test_home_planet_wrap_very_lonely_traveler(), test_exo_planet_pybind11_wrap_very_lonely_traveler()

* Resolve clang-tidy errors:

```
/__w/pybind11/pybind11/tests/test_cpp_conduit_traveler_bindings.h:39:32: error: parameter 'm' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param,-warnings-as-errors]
   10 |     py::class_<LonelyTraveler>(m, "LonelyTraveler");
      |                                ^
      |                                std::move( )
/__w/pybind11/pybind11/tests/test_cpp_conduit_traveler_bindings.h:43:52: error: parameter 'm' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param,-warnings-as-errors]
   43 |     py::class_<VeryLonelyTraveler, LonelyTraveler>(m, "VeryLonelyTraveler");
      |                                                    ^
      |                                                    std::move( )
```

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>
2024-09-13 00:18:29 -04:00
dependabot[bot]
5efc7439d4
chore(deps): bump the actions group with 2 updates (#5361)
Bumps the actions group with 2 updates: [deadsnakes/action](https://github.com/deadsnakes/action) and [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance).


Updates `deadsnakes/action` from 3.1.0 to 3.2.0
- [Release notes](https://github.com/deadsnakes/action/releases)
- [Commits](https://github.com/deadsnakes/action/compare/v3.1.0...v3.2.0)

Updates `actions/attest-build-provenance` from 1.4.2 to 1.4.3
- [Release notes](https://github.com/actions/attest-build-provenance/releases)
- [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md)
- [Commits](6149ea5740...1c608d11d6)

---
updated-dependencies:
- dependency-name: deadsnakes/action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: actions/attest-build-provenance
  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-09-09 14:31:38 -04:00
pre-commit-ci[bot]
8a801bdc32
chore(deps): update pre-commit hooks (#5350)
* chore(deps): update pre-commit hooks

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.6 → v0.6.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.6...v0.6.3)
- [github.com/pre-commit/mirrors-mypy: v1.11.1 → v1.11.2](https://github.com/pre-commit/mirrors-mypy/compare/v1.11.1...v1.11.2)
- [github.com/sirosen/texthooks: 0.6.6 → 0.6.7](https://github.com/sirosen/texthooks/compare/0.6.6...0.6.7)
- [github.com/PyCQA/pylint: v3.2.6 → v3.2.7](https://github.com/PyCQA/pylint/compare/v3.2.6...v3.2.7)
- [github.com/python-jsonschema/check-jsonschema: 0.29.1 → 0.29.2](https://github.com/python-jsonschema/check-jsonschema/compare/0.29.1...0.29.2)

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-09-03 10:51:21 -04:00
Ralf W. Grosse-Kunstleve
a05a201117 gee, sorry, managed to confuse myself 2024-09-02 11:10:57 -07:00
Ralf W. Grosse-Kunstleve
53579b458f Remove suffix in `concurrency: group: test-${{ github.ref }} (thanks @rhaschke for helping) 2024-09-02 11:06:41 -07:00
Ralf W. Grosse-Kunstleve
c31e79a33b Without the group this happened:
[pybind/pybind11] CI workflow run
CI: No jobs were run
2024-09-02 10:33:21 -07:00
Ralf W. Grosse-Kunstleve
f0d2da3d30 Revert "Remove stray `concurrency: group: test-${{ github.ref }} (thanks @rhaschke for catching this)"
This reverts commit 4cc11dc78f.
2024-09-02 10:31:47 -07:00
Ralf W. Grosse-Kunstleve
4cc11dc78f Remove stray `concurrency: group: test-${{ github.ref }} (thanks @rhaschke for catching this) 2024-09-02 10:29:03 -07:00
Ralf W. Grosse-Kunstleve
e5f57c473c Merge branch 'master' into sh_merge_master 2024-09-02 10:16:03 -07:00
Vasily Litvinov
aeda49ed0b
Properly translate C++ exception to Python exception when creating Python buffer from wrapped object (#5324)
* Add test for throwing def_buffer case

* Translate C++ -> Python exceptions in buffer creation

This required a little refactoring to extract exception translation to a separate method

* Fix code formatting

* Fix "unused parameter" warning

* Refactor per review

* style: pre-commit fixes

* Address review comments

* Address review comments

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-09-02 09:01:59 -07:00
Ralf W. Grosse-Kunstleve
bd8985aa0f
[smart_holder] Introduce PYBIND11_SMART_HOLDER_DISABLE option. (#5348)
* Step 1: Establish new `PYBIND11_SMART_HOLDER_ENABLED` macro, but only under include/pybind11/

At the stage `PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT` and `PYBIND11_SMART_HOLDER_ENABLED` are still equivalent.

* Systematically replace all `PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT` with `PYBIND11_SMART_HOLDER_ENABLED` under tests/ and ubench/

As at the previous stage, `PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT` and `PYBIND11_SMART_HOLDER_ENABLED` are still equivalent.

* Introduce `PYBIND11_SMART_HOLDER_DISABLE` option.

* `#ifdef` out entire `wrap()` function to avoid `unused-parameter` warning-as-error under macos-13

```
/Users/runner/work/pybind11/pybind11/tests/test_class_sh_trampoline_basic.cpp:67:23: error: unused parameter 'm' [-Werror,-Wunused-parameter]
void wrap(py::module_ m, const char *py_class_name) {
                      ^
/Users/runner/work/pybind11/pybind11/tests/test_class_sh_trampoline_basic.cpp:67:38: error: unused parameter 'py_class_name' [-Werror,-Wunused-parameter]
void wrap(py::module_ m, const char *py_class_name) {
                                     ^
2 errors generated.
```
2024-09-01 14:34:36 -07:00
Ralf W. Grosse-Kunstleve
a7b91e3326 Merge branch 'master' into sh_merge_master 2024-08-28 20:57:38 -07:00
Jan Iwaszkiewicz
66c3774a64
Warnings wrappers to use from C++ (#5291)
* Add warning wrappers that allow to call warnings from pybind level

* Add missing include for warnings.h

* Change messages on failed checks, extend testing

* clang-tidy fix

* Refactor tests for warnings

* Move handle before check

* Remove unnecessary parametrized
2024-08-28 20:55:50 -07:00
Ralf W. Grosse-Kunstleve
c7050dcaf1 Merge branch 'master' into sh_merge_master 2024-08-28 09:29:30 -07:00
Ralf W. Grosse-Kunstleve
65f4266cef
Add while True & top method to FAQ. (#5340) 2024-08-27 21:04:48 -07:00
Ralf W. Grosse-Kunstleve
f99ffd7e03
Remove test_classh_mock.cpp,py (#5338) 2024-08-26 11:56:00 -07:00
Ralf W. Grosse-Kunstleve
b0f715a02b Merge branch 'master' into sh_merge_master 2024-08-26 10:25:25 -07:00
Ralf W. Grosse-Kunstleve
5ed381daac
Replace all SMART_HOLDER_WIP comments with reminders, notes, or pointers. (#5336)
The SMART_HOLDER_WIP comments are mostly from 2021. In the meantime, the
smart_holder code was extremely thoroughly tested in the Google codebase
(production code). Additionally, testing via PyCLIF-pybind11 provided
thousands of diverse use cases that needed to satisfy many million unit tests
(the success rate was about 99.999%).
2024-08-26 10:23:51 -07:00
ObeliskGate
3fb16ad175
fix: using __cpp_nontype_template_args instead of __cpp_nontype_template_parameter_class (#5330)
* fix: use `__cpp_nontype_template_args` instead of gnu extensions

* fix: add feature test value

* fix: change `PYBIND11_TYPING_H_HAS_STRING_LITERAL` skip reason
2024-08-25 23:36:03 -04:00