Commit Graph

2865 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve d06d53694a
Fix small bug introduced with PR #4735 (#4845)
* Bug fix: `result[0]` called if `result.empty()`

* Add unit test that fails without the fix.
2023-09-14 09:47:34 -07:00
Sergei Izmailov 8c7b8dd0ae
fix: Missing typed variants of `iterator` and `iterable` (#4832) 2023-09-12 12:48:27 -07:00
Sergei Izmailov b4573674bc
Update render for buffer sequence and handle (#4831)
* fix: Add capitalize render name of `py::buffer` and `py::sequence`

* fix: Render `py::handle` same way as `py::object`

* tests: Fix tests `handle` -> `object`

* tests: Test capitaliation of `py::sequence` and `py::buffer`

* style: pre-commit fixes

* fix: Render `py::object` as `Any`

* Revert "fix: Render `py::object` as `Any`"

This reverts commit 7861dcfabb.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2023-09-12 12:47:39 -07:00
Sergei Izmailov c9149d995c
fix: Use lowercase builtin collection names (#4833) 2023-09-12 12:46:58 -07:00
Sergei Izmailov c83605936b
feature: Support move-only iterators in `py::make_*iterator` (#4834)
* feature: Support move-only iterators in `py::make_*iterator`

* fix: Missing static assertion message

* fixup: Missing `explicit` in single argument constructors

* fix: Simplify tests: make existing iterator move-only

* fix: Missing `noexcept`
2023-09-07 05:57:39 -07:00
dependabot[bot] 4a2f7e4681
chore(deps): bump actions/checkout from 1 to 4 (#4836)
* chore(deps): bump actions/checkout from 1 to 4

Bumps [actions/checkout](https://github.com/actions/checkout) from 1 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v1...v4)

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

Signed-off-by: dependabot[bot] <support@github.com>

* Update .github/workflows/ci.yml

* actions/checkout@v1 for centos:7

* Fix oversight: centos:7 actually works with actions/checkout@v3

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2023-09-06 15:57:18 -04:00
pre-commit-ci[bot] 467fe27bd9
chore(deps): update pre-commit hooks (#4838)
* chore(deps): update pre-commit hooks

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.281 → v0.0.287](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.281...v0.0.287)
- [github.com/pre-commit/mirrors-mypy: v1.4.1 → v1.5.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.4.1...v1.5.1)
- [github.com/asottile/blacken-docs: 1.15.0 → 1.16.0](https://github.com/asottile/blacken-docs/compare/1.15.0...1.16.0)
- [github.com/Lucas-C/pre-commit-hooks: v1.5.1 → v1.5.4](https://github.com/Lucas-C/pre-commit-hooks/compare/v1.5.1...v1.5.4)
- [github.com/PyCQA/pylint: v3.0.0a6 → v3.0.0a7](https://github.com/PyCQA/pylint/compare/v3.0.0a6...v3.0.0a7)

* style: pre-commit fixes

* Update pyproject.toml

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2023-09-06 06:04:27 -07:00
Ralf W. Grosse-Kunstleve c9638a1927
Help Coverty avoid generating a false positive. (#4817)
* Change variable name `it` to `curr_overl` to improve readability, add `assert()` in the only place where `curr_overl` could become `nullptr`.

* Move the `assert()` to where Coverty generates a false positive.

* variable name as suggested by @henryiii
2023-09-01 11:31:22 -07:00
Sergei Izmailov db412e6e86
fix: Render `py::function` as `Callable` (#4829)
* fix: Render `py::function` as `Callable`

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-30 22:43:01 -07:00
Sergei Izmailov e705fb5f27
Fix enum's `__str__` docstring (#4827)
* fix: Enum __str__ function name

* tests: Test enum.__str__.__doc__
2023-08-30 14:20:46 -07:00
Ralf W. Grosse-Kunstleve 1adac5a5b1
`PYBIND11_INTERNALS_VERSION` bump for MSVC, piggy-backed on PR #4779. See comments there. (#4819) 2023-08-30 10:05:24 -07:00
Peter Würtz 76b8858110
fix: Different MSVC versions may be ABI incompatible, guard with _MSC_VER (#2898) (#4779) 2023-08-23 09:49:35 -07:00
Jean Elsner b9359ceadb
Remove newlines from docstring signature (#4735)
* Remove newlines from docstring signature

* Jean/dev (#1)

Replace newlines in arg values with spaces

* style: pre-commit fixes

* Don't use std::find_if for C++ 11 compatibility

* Avoid implicit char to bool conversion

* Test default arguments for line breaks

* style: pre-commit fixes

* Separate Eigen tests

* style: pre-commit fixes

* Fix merge

* Try importing numpy

* Avoid unreferenced variable in catch block

* style: pre-commit fixes

* Update squash function

* Reduce try block

* Additional test cases

* style: pre-commit fixes

* Put statement inside braces

* Move string into function body

* Rename repr for better readability. Make constr explicit.

* Add multiline string default argument test case

* style: pre-commit fixes

* Add std namespace, do not modify string repr

* Test for all space chars, test str repr not modified

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-15 07:48:59 -07:00
Kenji f47ff3280e
Fix grammar in functions.rst (#4791)
The previous sentence had an extra "a" before "several", which isn't right.
2023-08-15 07:09:13 -07:00
Ralf W. Grosse-Kunstleve 80bcd21fb7
[ci skip] Adopt nanobind config. (#4792) 2023-08-15 07:02:54 -07:00
Ralf W. Grosse-Kunstleve add281a2da
Migrate to readthedocs configuration file v2¶ (#4789)
* Copy of recommded readthedocs configuration file v2

* [ci skip] It is now requirements (not requirements_file)
2023-08-14 21:46:17 -07:00
Henry Schreiner 9039e6ac42
chore: use 2x faster black mirror (#4784)
Committed via https://github.com/asottile/all-repos
2023-08-10 15:17:56 -04:00
Pieter P 4bf60c609a
Disable strip when build type is unset (#4454) (#4780) 2023-08-07 20:58:30 -07:00
Ralf W. Grosse-Kunstleve 690a115d84
Add `py::set_error()`, use in updated `py::exception<>` documentation (#4772)
* Copy clang 17 compatibility fixes from PR #4762 to a separate PR.

* static py::exception<> -> static py::handle

* Add `py::set_error()` but also try the suggestion of @malfet (https://github.com/pytorch/pytorch/pull/106401#pullrequestreview-1559961407).

* clang 17 compatibility fixes (#4767)

* Copy clang 17 compatibility fixes from PR #4762 to a separate PR.

* Add gcc:13 C++20

* Add silkeh/clang:16-bullseye C++20

* chore(deps): update pre-commit hooks (#4770)

updates:
- [github.com/psf/black: 23.3.0 → 23.7.0](https://github.com/psf/black/compare/23.3.0...23.7.0)
- [github.com/astral-sh/ruff-pre-commit: v0.0.276 → v0.0.281](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.276...v0.0.281)
- [github.com/asottile/blacken-docs: 1.14.0 → 1.15.0](https://github.com/asottile/blacken-docs/compare/1.14.0...1.15.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* docs: Remove upper bound on pybind11 in example pyproject.toml for setuptools (#4774)

* docs: Remove upper bound on pybind11 in example pyproject.toml for setuptools

* Update docs/compiling.rst

---------

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>

* Provide better type hints for a variety of generic types (#4259)

* Provide better type hints for a variety of generic types

* Makes better documentation
* tuple, dict, list, set, function

* Move to py::typing

* style: pre-commit fixes

* Update copyright line with correct year and actual author. The author information was copy-pasted from the git log output.

---------

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>

* Use `py::set_error()` everywhere possible (only one special case, in common.h).
Overload `py::set_error(py::handle, py::handle)`.
Change back to `static py::handle exc = ... .release();`
Deprecate `py::exception<>::operator()`

* Add `PYBIND11_WARNING_DISABLE` for INTEL and MSVC (and sort alphabetically).

* `PYBIND11_WARNING_DISABLE_INTEL(10441)` does not work.

For ICC only, falling back to the recommended `py::set_error()` to keep the testing simple.

It is troublesome to add `--diag-disable=10441` specifically for test_exceptions.cpp, even that is non-ideal because it covers the entire file, not just the one line we need it for, and the value of exercising the trivial deprecated `operator()` on this one extra platform is practically zero.

* Fix silly oversight.

* NVHPC 23.5.0 generates deprecation warnings. They are currently not treated as errors, but falling back to using `py::set_error()` to not have to deal with that distraction.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Keto D. Zhang <keto.zhang@gmail.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com>
2023-08-07 20:48:20 -07:00
Axel Huebl 824dc27a01
CI: Reenable an NVHPC Test (#4764)
Update from CentOS to Ubuntu and to a recent version
of NVHPC (former: PGI).

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2023-08-04 11:17:33 -07:00
Dustin Spicuzza f8703154ec
Provide better type hints for a variety of generic types (#4259)
* Provide better type hints for a variety of generic types

* Makes better documentation
* tuple, dict, list, set, function

* Move to py::typing

* style: pre-commit fixes

* Update copyright line with correct year and actual author. The author information was copy-pasted from the git log output.

---------

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>
2023-08-03 22:48:57 -07:00
Keto D. Zhang 9ad7e827a2
docs: Remove upper bound on pybind11 in example pyproject.toml for setuptools (#4774)
* docs: Remove upper bound on pybind11 in example pyproject.toml for setuptools

* Update docs/compiling.rst

---------

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2023-08-03 22:14:23 -07:00
pre-commit-ci[bot] 413e6328dc
chore(deps): update pre-commit hooks (#4770)
updates:
- [github.com/psf/black: 23.3.0 → 23.7.0](https://github.com/psf/black/compare/23.3.0...23.7.0)
- [github.com/astral-sh/ruff-pre-commit: v0.0.276 → v0.0.281](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.276...v0.0.281)
- [github.com/asottile/blacken-docs: 1.14.0 → 1.15.0](https://github.com/asottile/blacken-docs/compare/1.14.0...1.15.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-03 22:11:25 -07:00
Ralf W. Grosse-Kunstleve 17b614303f
clang 17 compatibility fixes (#4767)
* Copy clang 17 compatibility fixes from PR #4762 to a separate PR.

* Add gcc:13 C++20

* Add silkeh/clang:16-bullseye C++20
2023-08-03 13:36:29 -07:00
Ralf W. Grosse-Kunstleve f3e0602802
Add command to check for vX.Y.Z tag vs pybind11/_version.py consistency. (#4757)
* Add command to check for vX.Y.Z tag vs pybind11/_version.py consistency. Piggy-backing hints for converting changelog to release message.

* Simpler way of double-checking version number in sources vs. git tag

* Even simpler.

* Fix rst rendering (hopefully) and remove stray dots.

* [ci skip] Trying more to make GitHub rst renderer show this nicely.

* [ci skip] Fix up RST rendering issues.

Lesson learned:

This is NOT GOOD:

```
- Bullet nesting level 1.
    - Bullet nesting level 2.
```

This is BETTER:

```
- Bullet nesting level 1.
  - Bullet nesting level 2.
```

Also consistently adding empty lines between bullet points, to make the .rst
file easier to read.

Also piggy-backing a few very minor enhancements.
2023-07-23 11:10:10 -07:00
Ralf W. Grosse-Kunstleve 8d08dc64ca
Copy v2.11.1 changelog section as released. (#4755) 2023-07-17 12:07:42 -07:00
Ethan Steinberg 99131a85b6
Provide `PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF` as an option (#4753)
* Remove GIL checks

* Update common.h

* Add flag

* style: pre-commit fixes

* Update pytypes.h

* style: pre-commit fixes

* Update common.h

* style: pre-commit fixes

* Update pytypes.h

* style: pre-commit fixes

* Update common.h

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-07-17 00:05:52 -07:00
Ralf W. Grosse-Kunstleve ec1b57c50c
Disable `PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF` generally for PyPy (not just PyPy Windows). (#4751) 2023-07-15 12:55:00 -07:00
bzaar 0620d71638
Update README.rst - Add missing comma in the list of acknowlegements (#4750) 2023-07-15 09:58:54 -07:00
Ralf W. Grosse-Kunstleve e85696e80e
Post release version bump (#4747)
* Boilerplate version number update after v2.11.0 release.

* Small updates to release.rst
2023-07-14 14:53:58 -07:00
Ralf W. Grosse-Kunstleve 1a917f1852
docs: preparation for v2.11.0 release (#4744)
* Remove .dev1 from version number.

* Update Changelog (starting from `nox -s make_changelog` output)

* Miscellaneous minor fixes from proofreading in GitHub web view.

* docs: minor changelog updates

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-07-14 10:20:38 -05:00
Aaron Gokaslan b33d06f615
bugfix: fixes a test suite bug in the __new__ example (#4698)
* bugfix: fixes a test suite bug in the __new__ example

* See https://github.com/pybind/pybind11/pull/4698#discussion_r1227107682

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2023-07-12 13:20:08 -07:00
Henry Schreiner 2e5f5c4cf8
fix: support CMake 3.27, drop 3.4 (#4719)
* fix: support CMake 3.27, drop 3.4

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

* Update upgrade.rst

* Update upgrade.rst

* Update upgrade.rst

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2023-07-12 13:10:24 -05:00
Luc de Jonckheere 6d22dba82f
Warning on comparing wrapper enums with is (#4732)
* Warning on comparing wrapper enums with is

* backticks for quoting and link to related issue

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2023-07-12 08:56:40 -07:00
dependabot[bot] b2732c6e1a
chore(deps): bump pypa/gh-action-pypi-publish from 1.8.6 to 1.8.7 (#4718)
* chore(deps): bump pypa/gh-action-pypi-publish from 1.8.6 to 1.8.7

Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.6 to 1.8.7.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.6...v1.8.7)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Apply suggestions from code review

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2023-07-12 08:55:18 -07:00
pre-commit-ci[bot] 47dc0c4bd1
chore(deps): update pre-commit hooks (#4727)
updates:
- [github.com/pre-commit/mirrors-clang-format: v16.0.4 → v16.0.6](https://github.com/pre-commit/mirrors-clang-format/compare/v16.0.4...v16.0.6)
- https://github.com/charliermarsh/ruff-pre-commithttps://github.com/astral-sh/ruff-pre-commit
- [github.com/astral-sh/ruff-pre-commit: v0.0.270 → v0.0.276](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.270...v0.0.276)
- [github.com/pre-commit/mirrors-mypy: v1.3.0 → v1.4.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.3.0...v1.4.1)
- [github.com/asottile/blacken-docs: 1.13.0 → 1.14.0](https://github.com/asottile/blacken-docs/compare/1.13.0...1.14.0)
- [github.com/codespell-project/codespell: v2.2.4 → v2.2.5](https://github.com/codespell-project/codespell/compare/v2.2.4...v2.2.5)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2023-07-11 10:31:43 -07:00
dependabot[bot] d462dd91a5
chore(deps): bump scipy from 1.8.0 to 1.10.0 in /tests (#4731)
Bumps [scipy](https://github.com/scipy/scipy) from 1.8.0 to 1.10.0.
- [Release notes](https://github.com/scipy/scipy/releases)
- [Commits](https://github.com/scipy/scipy/compare/v1.8.0...v1.10.0)

---
updated-dependencies:
- dependency-name: scipy
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2023-07-10 10:43:20 -07:00
Ralf W. Grosse-Kunstleve 782b6281a2
Drop PyPy 3.7 from GitHub Actions (ci.yml) (#4728)
* Remove `pypy-3.7` from ci.yml

* Update .github/workflows/ci.yml

---------

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2023-07-09 09:40:47 -07:00
Henry Schreiner 5ccb9e412d
chore: ruff moved to astral-sh (#4726)
* chore: ruff moved to astral-sh

Committed via https://github.com/asottile/all-repos

* ci: bump CUDA version
2023-07-04 08:38:14 -04:00
Ralf W. Grosse-Kunstleve 2fb3d7cbde
Trivial refactoring to make the capsule API more user friendly. (#4720)
* Trivial refactoring to make the capsule API more user friendly.

* Use new API in production code. Thanks @Lalaland for pointing this out.
2023-06-27 15:08:32 -07:00
Ralf W. Grosse-Kunstleve e10da79b6e
Undo ci.yml gcc10 workaround after docker-library/gcc#95 was resolved. (#4717)
The gcc10 workaround was introduced with PR #4705.
2023-06-24 12:12:35 -07:00
Henry Schreiner bc1bcf7c05
chore: 3.12 + cleanup (#4713)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2023-06-21 13:25:10 -04:00
Ralf W. Grosse-Kunstleve 849322806c
Systematically add `PIP_BREAK_SYSTEM_PACKAGES` to all .yml files from which pip is called. (#4705)
* Systematically add PIP_BREAK_SYSTEM_PACKAGES to all .yml files from which pip is called.

* Try gcc:10-bullseye (because gcc:10 is broken: https://github.com/docker-library/gcc/issues/95)

* bug fix (matrix did not work as hoped)
2023-06-17 07:02:23 -07:00
Ralf W. Grosse-Kunstleve 86f60a0c07
pre-commit markdown-it-py<3 (for Python 3.7 compatibility) (#4704)
* markdown-it-py dropped Python 3.7 support, but we are type checking for Python 3.7 from a newer version of Python. Keep using markdown-it-py<3 as long as we support Python 3.7.

* Shuffle order of pre-commit checks for better agility.
2023-06-16 14:09:40 -07:00
Ralf W. Grosse-Kunstleve 0e43fcc75e
Python 3.12b2 testing (#4695)
* Uncomment `Interface test` sections (test_embed)

* fix: setuptools has been removed from default installs in 3.12

---------

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2023-06-10 10:14:08 -07:00
dependabot[bot] c679a92095
chore(deps): bump deadsnakes/action from 3.0.0 to 3.0.1 (#4687)
Bumps [deadsnakes/action](https://github.com/deadsnakes/action) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/deadsnakes/action/releases)
- [Commits](https://github.com/deadsnakes/action/compare/v3.0.0...v3.0.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2023-06-07 13:49:14 -07:00
pre-commit-ci[bot] 3617f3554a
chore(deps): update pre-commit hooks (#4689)
* chore(deps): update pre-commit hooks

updates:
- [github.com/charliermarsh/ruff-pre-commit: v0.0.263 → v0.0.270](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.263...v0.0.270)
- [github.com/pre-commit/mirrors-mypy: v1.2.0 → v1.3.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.2.0...v1.3.0)
- [github.com/shellcheck-py/shellcheck-py: v0.9.0.2 → v0.9.0.5](https://github.com/shellcheck-py/shellcheck-py/compare/v0.9.0.2...v0.9.0.5)
- [github.com/pre-commit/mirrors-clang-format: v16.0.2 → v16.0.4](https://github.com/pre-commit/mirrors-clang-format/compare/v16.0.2...v16.0.4)

* Resolve new ruff error:

```
tests/test_pytypes.py:478:20: PLW0130 Duplicate value `3` in set
```

The reduction from `{3, 3}` to `{3}` never happened in pybind11 code, therefore this change is essentially a no-op for the purpose of unit-testing pybind11.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2023-06-07 12:57:38 -07:00
Ralf W. Grosse-Kunstleve 29487dee8f
Disable 🐍 3 • CentOS7 / PGI 22.9 • x64 (#4691) 2023-06-07 12:00:37 -07:00
T.Yamada d0232b119f
Use annotated for array (#4679)
* use Annotated for std::array docstring

* add tests

* fix test

* style: pre-commit fixes

* fix valarray annotation

* style: pre-commit fixes

* refix test

* add FixedSize

* style: pre-commit fixes

* Update test_stl.py

* style: pre-commit fixes

---------

Co-authored-by: Taiju Yamada <taiju.yamada@mujin.co.jp>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-05-24 21:39:36 -07:00
Ralf W. Grosse-Kunstleve 8e1f9d5c40
Add `format_descriptor<>` & `npy_format_descriptor<>` `PyObject *` specializations. (#4674)
* Add `npy_format_descriptor<PyObject *>` to enable `py::array_t<PyObject *>` to/from-python conversions.

* resolve clang-tidy warning

* Use existing constructor instead of adding a static method. Thanks @Skylion007 for pointing out.

* Add `format_descriptor<PyObject *>`

Trivial addition, but still in search for a meaningful test.

* Add test_format_descriptor_format

* Ensure the Eigen `type_caster`s do not segfault when loading arrays with dtype=object

* Use `static_assert()` `!std::is_pointer<>` to replace runtime guards.

* Add comments to explain how to check for ref-count bugs. (NO code changes.)

* Make the "Pointer types ... are not supported" message Eigen-specific, as suggested by @Lalaland. Move to new pybind11/eigen/common.h header.

* Change "format_descriptor_format" implementation as suggested by @Lalaland. Additional tests meant to ensure consistency between py::format_descriptor<>, np.array, np.format_parser turn out to be useful only to highlight long-standing inconsistencies.

* resolve clang-tidy warning

* Account for np.float128, np.complex256 not being available on Windows, in a future-proof way.

* Fully address i|q|l ambiguity (hopefully).

* Remove the new `np.format_parser()`-based test, it's much more distracting than useful.

* Use bi.itemsize to disambiguate "l" or "L"

* Use `py::detail::compare_buffer_info<T>::compare()` to validate the `format_descriptor<T>::format()` strings.

* Add `buffer_info::compare<T>` to make `detail::compare_buffer_info<T>::compare` more visible & accessible.

* silence clang-tidy warning

* pytest-compatible access to np.float128, np.complex256

* Revert "pytest-compatible access to np.float128, np.complex256"

This reverts commit e9a289c50f.

* Use `sizeof(long double) == sizeof(double)` instead of `std::is_same<>`

* Report skipped `long double` tests.

* Change the name of the new `buffer_info` member function to `item_type_is_equivalent_to`. Add comment defining "equivalent" by example.

* Change `item_type_is_equivalent_to<>()` from `static` function to member function, as suggested by @Lalaland
2023-05-23 10:49:32 -07:00