1. 13 Dec, 2022 1 commit
  2. 10 Dec, 2022 1 commit
  3. 09 Dec, 2022 4 commits
    • Add flake8 `B905` to `extend-ignore` in setup.cfg (#4391) · 663b86c2
      * Add flake8 `--ignore=B905,N818,W503`
      
      * Add B905 to `extend-ignore` in setup.cfg (thanks @Skylion007), leave .pre-commit-config.yaml as-is on master.
      Ralf W. Grosse-Kunstleve committed
    • Correct class names for KeysView, ValuesView and ItemsView in bind_map (#4353) · 9db98801
      * Create templated abstract classes KeysView, ValuesView and ItemsView, and implement them on-the-fly when wrapping any specific map type
      
      * We don't want to wrap different ValuesView objects for double values and const double, for example, as both wrappers will be named ValuesView[float]
      
      * Fallback to C++ names if key or values types are not wrapped
      
      * Added a test for .keys(), .values() and .items() returning the same types for similarly-typed maps
      
      * Fixed wrong use of auto in a declarator list: the two descriptions might have different types
      
      * Fixes for clang-tidy issues: explicit single-argument constructor, using the 'override' keyword when overriding functions
      
      * Bugfix for old versions of clang++, which seem to have trouble with the struct being defined inside a module, which was also needlessly ugly anyway
      
      * Bugfix for clang++, which doesn't have some of the names in runtime uness they are specified to be static
      
      * A fix for clang-tidy performance-inefficient-string-concatenation issues - I personally think this looks uglier, but it's probably worth it for clang-tidy to be happy
      
      * Possible fix for clang++ linking issues - make the descriptions static constexpr to make sure they are known before linking
      
      * Correct names for previously-wrapped types as keys/values of maps
      
      * Bugfix - typo in type info names which caused things to segfault
      
      * Apply suggestions from code review
      
      Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
      
      * Use detail::remove_cvref_t instead of doing remove_cv and remove_reference separately
      
      * Avoid names with double underscore, as they are reserved
      
      * Improved testing for KeysView, ValuesView and ItemsView: check type names + stricter asserts
      
      * Moved description logic to helper function in type_caster_base.h
      
      * style: pre-commit fixes
      
      * Fix a clang-tidy issue: do not use 'else' after 'return'
      
      * Apply suggestion by @Skylion007, with additional trivial simplification.
      
      Co-authored-by: Amir <aimir@local>
      Co-authored-by: aimir <aimir@localhost>
      Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
      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>
      aimir committed
    • Add option for enable/disable enum members in docstring. (#2768) · 00126859
      * Add option for enable/disable enum members in docstring
      
      * Add tests for disable enum members docstring option
      
      * Add docstring options to documentation
      
      * style: pre-commit fixes
      
      * Fix typos in documentation
      
      * Improve documentation wording
      
      * Apply suggestions by @Skylion007
      
      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>
      Frank committed
    • `pybind11::handle` `inc_ref()` & `dec_ref()` `PyGILState_Check()` **excluding** `nullptr` (#4246) · 65374c8e
      * pybind11/pytypes.h `inc_ref()`, `dec_ref()` `PyGILState_Check()` **excluding** `nullptr`
      
      Guarded by `PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF`
      
      * Disable `PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF` for PyPy under Windows.
      
      * Add reference to PR #4268 (PyPy Windows)
      Ralf W. Grosse-Kunstleve committed
  4. 07 Dec, 2022 1 commit
  5. 06 Dec, 2022 2 commits
  6. 05 Dec, 2022 3 commits
  7. 01 Dec, 2022 4 commits
  8. 28 Nov, 2022 1 commit
  9. 25 Nov, 2022 1 commit
  10. 23 Nov, 2022 1 commit
  11. 22 Nov, 2022 1 commit
  12. 12 Nov, 2022 2 commits
  13. 10 Nov, 2022 1 commit
  14. 02 Nov, 2022 1 commit
    • Fix functional.h bug + introduce test to verify that it is fixed (#4254) · ee2b5226
      * Illustrate bug in functional.h
      
      * style: pre-commit fixes
      
      * Make functional casting more robust / add workaround
      
      * Make function_record* casting even more robust
      
      * See if this fixes PyPy issue
      
      * It still fails on PyPy sadly
      
      * Do not make new CTOR just yet
      
      * Fix test
      
      * Add name to ensure correctness
      
      * style: pre-commit fixes
      
      * Clean up tests + remove ifdef guards
      
      * Add comments
      
      * Improve comments, error handling, and safety
      
      * Fix compile error
      
      * Fix magic logic
      
      * Extract helper function
      
      * Fix func signature
      
      * move to local internals
      
      * style: pre-commit fixes
      
      * Switch to simpler design
      
      * style: pre-commit fixes
      
      * Move to function_record
      
      * style: pre-commit fixes
      
      * Switch to internals, update tests and docs
      
      * Fix lint
      
      * Oops, forgot to resolve last comment
      
      * Fix typo
      
      * Update in response to comments
      
      * Implement suggestion to improve test
      
      * Update comment
      
      * Simple fixes
      
      Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
      Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>
      Ethan Steinberg committed
  15. 01 Nov, 2022 2 commits
  16. 31 Oct, 2022 3 commits
    • docs: prepare for 2.10.1 release (#4279) · 252ed8fb
      * docs: prepare for 2.10.1 release
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * Update changelog.rst
      
      * docs: update changelog with final list of PRs
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * Update docs/changelog.rst
      
      * chore: one more changelog bump
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      Henry Schreiner committed
    • fix: define (non-empty) `PYBIND11_EXPORT_EXCEPTION` only under macOS. (#4298) · b1bd7f26
      Background: #2999, #4105, #4283, #4284
      
      In a nutshell:
      
      * Only macOS actually needs `PYBIND11_EXPORT_EXCEPTION` (#4284).
      
      * Evidently (#4283), under macOS `PYBIND11_EXPORT_EXCEPTION` does not run the risk of introducing ODR violations,
      
      * but evidently (#4283) under Linux it does, in the presumably rare/unusual situation that `RTLD_GLOBAL` is used.
      
      * Windows does no have the equivalent of `RTLD_GLOBAL`, therefore `PYBIND11_EXPORT_EXCEPTION` has no practical benefit, on the contrary, noisy warning suppression pragmas are needed, therefore it is best left empty.
      Ralf W. Grosse-Kunstleve committed
    • fix: unicode surrogate character in Python exception message. (#4297) · 3a2c96bd
      * Fix & test for issue #4288 (unicode surrogate character in Python exception message).
      
      * DRY `message_unavailable_exc`
      
      * fix: add a constexpr
      
      Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
      
      * style: pre-commit fixes
      
      Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
      Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
      Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
      Ralf W. Grosse-Kunstleve committed
  17. 30 Oct, 2022 2 commits
    • Add `PYBIND11_SIMPLE_GIL_MANAGEMENT` option (cmake, C++ define) (#4216) · b07d08f6
      * Add option to force the use of the PYPY GIL scoped acquire/release logic to support nested gil access, see https://github.com/pybind/pybind11/issues/1276 and https://github.com/pytorch/pytorch/issues/83101
      
      * Apply suggestions from code review
      
      * Update CMakeLists.txt
      
      * docs: update upgrade guide
      
      * Update docs/upgrade.rst
      
      * All bells & whistles.
      
      * Add Reminder to common.h, so that we will not forget to purge `!WITH_THREAD` branches when dropping Python 3.6
      
      * New sentence instead of semicolon.
      
      * Temporarily pull in snapshot of PR #4246
      
      * Add `test_release_acquire`
      
      * Add more unit tests for nested gil locking
      
      * Add test_report_builtins_internals_keys
      
      * Very minor enhancement: sort list only after filtering.
      
      * Revert change in docs/upgrade.rst
      
      * Add test_multi_acquire_release_cross_module, while also forcing unique PYBIND11_INTERNALS_VERSION for cross_module_gil_utils.cpp
      
      * Hopefully fix apparently new ICC error.
      
      ```
      2022-10-28T07:57:54.5187728Z -- The CXX compiler identification is Intel 2021.7.0.20220726
      ...
      2022-10-28T07:58:53.6758994Z icpc: remark #10441: The Intel(R) C++ Compiler Classic (ICC) is deprecated and will be removed from product release in the second half of 2023. The Intel(R) oneAPI DPC++/C++ Compiler (ICX) is the recommended compiler moving forward. Please transition to use this compiler. Use '-diag-disable=10441' to disable this message.
      2022-10-28T07:58:54.5801597Z In file included from /home/runner/work/pybind11/pybind11/include/pybind11/detail/../detail/type_caster_base.h(15),
      2022-10-28T07:58:54.5803794Z                  from /home/runner/work/pybind11/pybind11/include/pybind11/detail/../cast.h(15),
      2022-10-28T07:58:54.5805740Z                  from /home/runner/work/pybind11/pybind11/include/pybind11/detail/../attr.h(14),
      2022-10-28T07:58:54.5809556Z                  from /home/runner/work/pybind11/pybind11/include/pybind11/detail/class.h(12),
      2022-10-28T07:58:54.5812154Z                  from /home/runner/work/pybind11/pybind11/include/pybind11/pybind11.h(13),
      2022-10-28T07:58:54.5948523Z                  from /home/runner/work/pybind11/pybind11/tests/cross_module_gil_utils.cpp(13):
      2022-10-28T07:58:54.5949009Z /home/runner/work/pybind11/pybind11/include/pybind11/detail/../detail/internals.h(177): error #2282: unrecognized GCC pragma
      2022-10-28T07:58:54.5949374Z       PYBIND11_TLS_KEY_INIT(tstate)
      2022-10-28T07:58:54.5949579Z       ^
      2022-10-28T07:58:54.5949695Z
      ```
      
      * clang-tidy fixes
      
      * Workaround for PYPY WIN exitcode None
      
      * Revert "Temporarily pull in snapshot of PR #4246"
      
      This reverts commit 23ac16e859150f27fda25ca865cabcb4444e0770.
      
      * Another workaround for PYPY WIN exitcode None
      
      * Clean up how the tests are run "run in process" Part 1: uniformity
      
      * Clean up how the tests are run "run in process" Part 2: use `@pytest.mark.parametrize` and clean up the naming.
      
      * Skip some tests `#if defined(THREAD_SANITIZER)` (tested with TSAN using the Google-internal toolchain).
      
      * Run all tests again but ignore ThreadSanitizer exitcode 66 (this is less likely to mask unrelated ThreadSanitizer issues in the future).
      
      * bug fix: missing common.h include before using `PYBIND11_SIMPLE_GIL_MANAGEMENT`
      
      For the tests in the github CI this does not matter, because
      `PYBIND11_SIMPLE_GIL_MANAGEMENT` is always defined from the command line,
      but when monkey-patching common.h locally, it matters.
      
      * if process.exitcode is None: assert t_delta > 9.9
      
      * More sophisiticated `_run_in_process()` implementation, clearly reporting `DEADLOCK`, additionally exercised via added `intentional_deadlock()`
      
      * Wrap m.intentional_deadlock in a Python function, for `ForkingPickler` compatibility.
      
      ```
      >       ForkingPickler(file, protocol).dump(obj)
      E       TypeError: cannot pickle 'PyCapsule' object
      ```
      
      Observed with all Windows builds including mingw but not PyPy, and macos-latest with Python 3.9, 3.10, 3.11 but not 3.6.
      
      * Add link to potential solution for WOULD-BE-NICE-TO-HAVE feature.
      
      * Add `SKIP_IF_DEADLOCK = True` option, to not pollute the CI results with expected `DEADLOCK` failures while we figure out what to do about them.
      
      * Add COPY-PASTE-THIS: gdb ... command (to be used for debugging the detected deadlock)
      
      * style: pre-commit fixes
      
      * Do better than automatic pre-commit fixes.
      
      * Add `PYBIND11_SIMPLE_GIL_MANAGEMENT` to `pytest_report_header()` (so that we can easily know when harvesting deadlock information from the CI logs).
      
      Co-authored-by: Arnim Balzer <arnim@seechange.ai>
      Co-authored-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>
      Chekov2k committed
  18. 29 Oct, 2022 1 commit
  19. 26 Oct, 2022 1 commit
  20. 23 Oct, 2022 3 commits
  21. 22 Oct, 2022 1 commit
    • Fix casts to void* (#4275) · 8ea75ab4
      * Fix casts to void*
      
      * Improve tests
      
      * style: pre-commit fixes
      
      * remove c style cast
      
      Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
      Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>
      Lalaland committed
  22. 21 Oct, 2022 3 commits