1. 15 Aug, 2023 1 commit
  2. 10 Aug, 2023 1 commit
  3. 08 Aug, 2023 2 commits
    • Add `py::set_error()`, use in updated `py::exception<>` documentation (#4772) · 690a115d
      * 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>
      Ralf W. Grosse-Kunstleve committed
  4. 04 Aug, 2023 4 commits
  5. 03 Aug, 2023 1 commit
  6. 23 Jul, 2023 1 commit
    • Add command to check for vX.Y.Z tag vs pybind11/_version.py consistency. (#4757) · f3e06028
      * 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.
      Ralf W. Grosse-Kunstleve committed
  7. 17 Jul, 2023 2 commits
  8. 15 Jul, 2023 2 commits
  9. 14 Jul, 2023 2 commits
  10. 12 Jul, 2023 4 commits
  11. 11 Jul, 2023 1 commit
  12. 10 Jul, 2023 1 commit
  13. 09 Jul, 2023 1 commit
  14. 04 Jul, 2023 1 commit
  15. 27 Jun, 2023 1 commit
  16. 24 Jun, 2023 1 commit
  17. 21 Jun, 2023 1 commit
  18. 17 Jun, 2023 1 commit
  19. 16 Jun, 2023 1 commit
  20. 10 Jun, 2023 1 commit
  21. 07 Jun, 2023 3 commits
  22. 25 May, 2023 1 commit
    • Use annotated for array (#4679) · d0232b11
      * 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>
      T.Yamada committed
  23. 23 May, 2023 3 commits
    • Add `format_descriptor<>` & `npy_format_descriptor<>` `PyObject *` specializations. (#4674) · 8e1f9d5c
      * 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 e9a289c50fc07199806d14ded644215ab6f03afa.
      
      * 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
      Ralf W. Grosse-Kunstleve committed
    • Create s Security Policy (#4671) · 6e6bcca5
      * Create SECURITY.md
      
      * Update test_files.py to include SECURITY.md file
      
      * Update MANIFEST.in to include SECURITY.md file
      Joyce committed
    • Python 3.11+: Add `__notes__` to `error_already_set::what()` output. (#4678) · ce9bbc0a
      * First version adding `__notes__` to `error_already_set::what()` output.
      
      * Fix trivial oversight (missing adjustment in existing test).
      
      * Minor enhancements of new code.
      
      * Re-enable `cmake --target cpptest -j 2`
      
      * Revert "Re-enable `cmake --target cpptest -j 2`"
      
      This reverts commit 60816285e9e7b95b7d33a60805888b80b2bec641.
      
      * Add general comment explaining why the `error_fetch_and_normalize` code is so unusual.
      Ralf W. Grosse-Kunstleve committed
  24. 22 May, 2023 1 commit
    • chore: update changelog, with target date for v2.11.0 release (#4677) · 19816f0d
      * Remove .dev1 from version number.
      
      * [skip ci] Update changelog.rst
      
      * [ci skip] Fix pre-commit: rst ``code`` is two backticks
      
      * Apply fix suggested by @henryiii
      
      * [ci skip] Set target date for the release to June 2, 2023
      
      * [ci skip] Apply more fixes suggested by @henryiii (I missed those before).
      
      * [ci skip] Revert "Remove .dev1 from version number."
      
      This reverts commit afc80134cb1035be2913fd8153a16a864181c52c.
      Ralf W. Grosse-Kunstleve committed
  25. 15 May, 2023 1 commit
    • ci: set minimal permissions to github workflows (#4665) · d72ffb44
      * set ci.yml minimal permissions
      
      Signed-off-by: Joyce <joycebrum@google.com>
      
      * set configure.yml minimal permissions
      
      Signed-off-by: Joyce <joycebrum@google.com>
      
      * set format.yml minimal permissions
      
      Signed-off-by: Joyce <joycebrum@google.com>
      
      * set pip.yml minimal permissions
      
      Signed-off-by: Joyce <joycebrum@google.com>
      
      * set upstream.yml minimal permissions
      
      Signed-off-by: Joyce <joycebrum@google.com>
      
      * set labeler.yml minimal permissions
      
      Signed-off-by: Joyce <joycebrum@google.com>
      
      * Update ci.yml to read all
      
      Signed-off-by: Joyce <joycebrum@google.com>
      
      * test labeler.yml
      
      Signed-off-by: Joyce <joycebrum@google.com>
      
      * restore the if at labeler.yml
      
      Signed-off-by: Joyce <joycebrum@google.com>
      
      ---------
      
      Signed-off-by: Joyce <joycebrum@google.com>
      Joyce committed
  26. 09 May, 2023 1 commit
    • Update errors in string "Explicit conversions" docs (#4658) · cca4c51c
      `PyUnicode_DecodeLatin1` requires you to pass in the `error`
      parameter. The code as it is in the docs didn't compile.
      
      There is a reference leak in the example
      code. `PyUnicode_DecodeLatin1` returns a new reference. Calling
      `py::str(PyObject*)` calls `PyObject_Str`, which also returns a new
      reference. That reference is managed by the `py::str`
      constructor (which correctly steals the reference, using the
      `stolen_t` constructor), but the original reference returned by
      `PyUnicode_DecodeLatin1` is never decref'd: it never makes it into an
      `object`, and it's never manually decremented.
      
      This fixes both of those issues. The code compiles, and I viewed the
      sphinx docs locally.
      Tim Stumbaugh committed