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] git merge master #5474

Merged
merged 11 commits into from
Dec 20, 2024
Merged

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented Dec 20, 2024

Description

Helper/scratch PR for testing.

Suggested changelog entry:

msimacek and others added 11 commits November 18, 2024 14:39
* Disable print_destroyed in tests on GraalPy

* Reenable test_iostream on GraalPy
Bumps the actions group with 1 update: [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel).


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

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

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…#5448)

* fix: make PYBIND11_WARNING_POP actually pop clang diagnostics

* fix: ignore -Wgnu-zero-variadic-macro-arguments on clang

* Revert "fix: ignore -Wgnu-zero-variadic-macro-arguments on clang"

This reverts commit d310959.

* C++20 modernization: Use `__VA_OPT__(, ) __VA_ARGS__` in `PYBIND11_DECLARE_HOLDER_TYPE()`

* Disable `__VA_OPT__(, ) __VA_ARGS__` usage for MSVC (it is unclear to rwgk why it does not work).

This is the beginning of the error message:

```
         D:\a\pybind11\pybind11\tests\test_smart_ptr.cpp(285,1): error C2143: syntax error: missing ')' before ',' [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]
         D:\a\pybind11\pybind11\tests\test_smart_ptr.cpp(285,1): error C2059: syntax error: ')' [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]
```

* Add `PYBIND11_WARNING_DISABLE_CLANG("-Wgnu-zero-variadic-macro-arguments")` in test_smart_ptr.cpp

This is the error message:

```
/__w/pybind11/pybind11/tests/test_smart_ptr.cpp:287:51: error: must specify at least one argument for '...' parameter of variadic macro [-Werror,-Wgnu-zero-variadic-macro-arguments]
PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>)
                                                  ^
/__w/pybind11/pybind11/include/pybind11/cast.h:885:13: note: macro 'PYBIND11_DECLARE_HOLDER_TYPE' defined here
            ^
```

* Also add `PYBIND11_WARNING_DISABLE_CLANG("-Wgnu-zero-variadic-macro-arguments")` in test_virtual_functions.cpp

* Also add `PYBIND11_WARNING_DISABLE_CLANG("-Wgnu-zero-variadic-macro-arguments")` in test_embed/test_interpreter.cpp

* Undo all changes except the original push -> pop fix.

* 1. Add `PYBIND11_WARNING_DISABLE_CLANG("-Wgnu-zero-variadic-macro-arguments")` near the top of pybind11/pybind11.h; 2. Change `PYBIND11_DECLARE_HOLDER_TYPE` macro to side-step the only remaining clang warning-as-error (this is still needed even for clang 18).

Alternatively the warning suppression could be moved into pybind11/cast.h, but this commit limits the warning suppression to smaller scope within include/pybind11.

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <[email protected]>
…em::path (pybind#5450)

* Added arg/return type handling.

* Added support for nested arg/return type in py::typing::List

* Added support for arg/return type in stl/filesystem

* Added tests for arg/return type in stl/filesystem and py::typing::List

* Added arg/return name to more py::typing classes

* Added arg/return type to Callable[...]

* Added tests for typing container classes (also nested)

* Changed typing classes to avoid using C++14 auto return type deduction.

* Fixed clang-tidy errors.

* Changed Enable to SFINAE

* Added test for Tuple[T, ...]

* Added RealNumber with custom caster for testing typing classes.

* Added tests for Set, Iterable, Iterator, Union, and Optional

* Added tests for Callable

* Fixed Callable with ellipsis test

* Changed TypeGuard/TypeIs to use return type (being the narrower type) + Tests

* Added test for use of fallback type name with stl vector

* Updated documentation.

* Fixed unnecessary constructor call in test.

* Fixed reference counting in example type caster.

* Fixed clang-tidy issues.

* Fix for clang-tidy

* Updated cast method to use pybind11 API rather than Python C API in custom caster example

* Updated load to use pybind11 API rather than Python C API in custom caster example

* Changed test of arg/return name to use pybind11 API instead of Python C API

* Updated code in adcanced/cast example and improved documentation text

* Fixed references in custom type caster docs

* Fixed wrong logical and operator in test

* Fixed wrong logical operator in doc example

* Added comment to test about `float` vs `float | int`

* Updated std::filesystem::path docs in cast/overview section

* Remove one stray dot.

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <[email protected]>
* chore(deps): update pre-commit hooks

updates:
- [github.com/pre-commit/mirrors-clang-format: v19.1.3 → v19.1.4](pre-commit/mirrors-clang-format@v19.1.3...v19.1.4)
- [github.com/astral-sh/ruff-pre-commit: v0.7.2 → v0.8.1](astral-sh/ruff-pre-commit@v0.7.2...v0.8.1)
- [github.com/sirosen/texthooks: 0.6.7 → 0.6.8](sirosen/texthooks@0.6.7...0.6.8)
- [github.com/PyCQA/pylint: v3.3.1 → v3.3.2](pylint-dev/pylint@v3.3.1...v3.3.2)
- [github.com/python-jsonschema/check-jsonschema: 0.29.4 → 0.30.0](python-jsonschema/check-jsonschema@0.29.4...0.30.0)

* Resolve ruff pre-commit errors:

```
ruff.....................................................................Failed
- hook id: ruff
- exit code: 1

warning: The following rules have been removed and ignoring them has no effect:
    - PT004

docs/benchmark.py:51:17: UP031 Use format specifiers instead of percent format
   |
50 |     for cl in range(nclasses):
51 |         decl += "class cl%03i {\n" % cl
   |                 ^^^^^^^^^^^^^^^^^^ UP031
52 |         decl += "public:\n"
53 |         bindings += f'    py::class_<cl{cl:03}>("cl{cl:03}")\n'
   |
   = help: Replace with format specifiers

docs/benchmark.py:88:15: UP031 Use format specifiers instead of percent format
   |
86 |         elapsed = (n2 - n1).total_seconds()
87 |         size = os.stat("test.so").st_size
88 |         print("   {%i, %f, %i}," % (nclasses * nfns, elapsed, size))
   |               ^^^^^^^^^^^^^^^^^^ UP031
89 |     print("}")
   |
   = help: Replace with format specifiers

tools/make_changelog.py:62:9: PLC0206 Extracting value from dictionary without calling `.items()`
   |
61 |           msg += f"\n  `#{issue.number} <{issue.html_url}>`_"
62 |           for cat in cats:
   |  _________^
63 | |             if issue.title.lower().startswith(f"{cat}:"):
64 | |                 cats[cat].append(msg)
65 | |                 break
66 | |         else:
67 | |             cats["unknown"].append(msg)
   | |_______________________________________^ PLC0206
68 |
69 |   for cat, msgs in cats.items():
   |

Found 3 errors.

```

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <[email protected]>
pybind#5461)

Bumps the actions group with 1 update: [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance).


Updates `actions/attest-build-provenance` from 1.4.4 to 2.0.1
- [Release notes](https://github.com/actions/attest-build-provenance/releases)
- [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md)
- [Commits](actions/attest-build-provenance@ef24412...c4fbc64)

---
updated-dependencies:
- dependency-name: actions/attest-build-provenance
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Drop clang dev job for now.
…han MSVC) (pybind#5439)

* THIS IS JUST A START: First attempt to combine information from PR pybind#4953 and PR pybind#5437

* Include GXX_ABI and USE_CXX in the identifier

Further constrain to GXX_ABI 1002 or greater and less than 2000,
hopefully future proof by summarizing that as `1` along with CXX11 on or
off.

* style: pre-commit fixes

* Use `gxx_abi_1xxx` and simplify the Clang string

After discussions with Ralf Grosse-Kunstleve we think these would make
good identifiers that are concise and clear.

* Error if `_GLIBCXX_USE_CXX11_ABI` is not defined

Within the `__GXX_ABI_VERSION` block this should always be defined,
guard against unexpected defines and make the error obvious.

* Change `usecxx11` to `use_cxx11_abi` for correspondence with `_GLIBCXX_USE_CXX11_ABI` (similarly to `gxx_abi` for `__GXX_ABI_VERSION`).

* `PYBIND11_COMPILER_TYPE` overhaul, mainly: replace `_icc`, `_clang`, `_gcc` with `_system`

* Add NVHPC (__PGI) to the list of compilers compatible with system compiler.

See comment by @robertmaynard: pybind#5439 (comment)

* Fix oversight: remove __NVCOMPILER elif branch in PYBIND11_BUILD_ABI block.

Also add comment pointing to this PR (pybind#5439).

* Revert "Fix oversight: remove __NVCOMPILER elif branch in PYBIND11_BUILD_ABI block."

This reverts commit d412303.

* Revert "Add NVHPC (__PGI) to the list of compilers compatible with system compiler."

This reverts commit 9fc9515.

* Define NVHPC PYBIND11_BUILD_ABI using __GNUC__, __GNUC_MINOR__, _GLIBCXX_USE_CXX11_ABI

* Use _GLIBCXX_USE_CXX11_ABI to detect libstdc++, then assume that NVHPC is always in the 1xxx ABI family.

* Enhance NVHPC comment and limited future proofing.

* The `PYBIND11_STDLIB` is obsolete but kept around to maintain backward compatibility.

* Move `PYBIND11_BUILD_TYPE` down in the file, so that the order of macro definitions is the same as in the list defining `PYBIND11_PLATFORM_ABI_ID`

* Introduce `PYBIND11_COMPILER_TYPE_LEADING_UNDERSCORE`:

This makes it possible to achieve these two goals:

* Avoid the leading underscore in `PYBIND11_PLATFORM_ABI_ID` (see pybind#5439 (comment))

* Maintain backward compatibility for use cases as reported under pybind#5439 (comment)

`PYBIND11_INTERNALS_KIND` is removed in this commit to ensure that `PYBIND11_COMPILER_TYPE` is the first element of the `PYBIND11_PLATFORM_ABI_ID`, so that `PYBIND11_COMPILER_TYPE_LEADING_UNDERSCORE` can meaningfully be used as a prefix for `PYBIND11_PLATFORM_ABI_ID` in pybind11/detail/internals.h.

* Apply suggestion by @isuruf, with revised comments (code is as suggested).

* Make determination of `PYBIND11_COMPILER_TYPE` `"macos"` or `"glibc"` more general.

The main motivation is to resolve these "Manylinux on 🐍 3.13t • GIL" and "Pyodide wheel" failures:

```
/__w/pybind11/pybind11/include/pybind11/conduit/pybind11_platform_abi_id.h:35:10: error: #error "Unknown PYBIND11_COMPILER_TYPE: PLEASE REVISE THIS CODE."
   35 | #        error "Unknown PYBIND11_COMPILER_TYPE: PLEASE REVISE THIS CODE."
      |          ^~~~~
```

(All other CI jobs succeeded.)

Further thought:

Essentially, under Linux and macOS the `PYBIND11_COMPILER_TYPE` is only for informational purposes.
ABI compatibility is determined by the libstdc++ or libc++ ABI version.

* Add `PYBIND11_COMPILER_TYPE` `emscripten`

* Add `PYBIND11_COMPILER_TYPE` `graalvm`

* Revert "Add `PYBIND11_COMPILER_TYPE` `graalvm`"

This reverts commit 75da5fb.

* Revert "Add `PYBIND11_COMPILER_TYPE` `emscripten`"

This reverts commit e34dc8b.

* Revert "Make determination of `PYBIND11_COMPILER_TYPE` `"macos"` or `"glibc"` more general."

This reverts commit 41daaa4.

* Revert "Apply suggestion by @isuruf, with revised comments (code is as suggested)."

This reverts commit ca9e699.

* Remove `defined(__INTEL_COMPILER)` as suggested by @hpkfft under pybind#5439 (comment)

---------

Co-authored-by: Marcus D. Hanwell <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
pybind#5468)

Bumps the actions group with 1 update: [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance).


Updates `actions/attest-build-provenance` from 2.0.1 to 2.1.0
- [Release notes](https://github.com/actions/attest-build-provenance/releases)
- [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md)
- [Commits](actions/attest-build-provenance@c4fbc64...7668571)

---
updated-dependencies:
- dependency-name: actions/attest-build-provenance
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@rwgk rwgk merged commit 58042d4 into pybind:smart_holder Dec 20, 2024
78 checks passed
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Dec 20, 2024
@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label Dec 20, 2024
@rwgk rwgk deleted the sh_merge_master branch December 20, 2024 20:22
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.

4 participants