Commit Graph

3355 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve
3036510bb7 Merge branch 'master' into sh_merge_master 2022-12-05 14:35:42 -08:00
Xiaofei Wang
c1f14f0511
[smart_holder] Auto select return value policy for clif_automatic (#4381)
* Auto select return value policy for clif_automatic

* Try fixing test failures

* Add more tests.

* remove comments

* Fix test failures

* Fix test failures

* Fix test failure for windows platform

* Fix clangtidy
2022-12-05 14:32:54 -08:00
dependabot[bot]
a6e75e4d8a
chore(deps): bump pypa/gh-action-pypi-publish from 1.5.2 to 1.6.1 (#4384)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.5.2 to 1.6.1.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.5.2...v1.6.1)

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

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-05 01:03:05 -08:00
dependabot[bot]
6a1023e3e9
chore(deps): bump deadsnakes/action from 2.1.1 to 3.0.0 (#4383)
Bumps [deadsnakes/action](https://github.com/deadsnakes/action) from 2.1.1 to 3.0.0.
- [Release notes](https://github.com/deadsnakes/action/releases)
- [Commits](https://github.com/deadsnakes/action/compare/v2.1.1...v3.0.0)

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

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-05 01:01:45 -08:00
Ralf W. Grosse-Kunstleve
5b55f8fe82
Replace ubuntu-latest with ubuntu-22.04 (#4382)
* Replace 🐍 3.6 • ubuntu-latest • x64 -DPYBIND11_FINDPYTHON=ON -DCMAKE_CXX_FLAGS="-D_=1" with 3.9

* Revert "Replace 🐍 3.6 • ubuntu-latest • x64 -DPYBIND11_FINDPYTHON=ON -DCMAKE_CXX_FLAGS="-D_=1" with 3.9"

This reverts commit 3ec984e1ed.

* Systematically change all active ubuntu-latest to ubuntu-20.04, except in upstream.yml

* Revert "Systematically change all active ubuntu-latest to ubuntu-20.04, except in upstream.yml"

This reverts commit cdfd99526a.

* Change only some ubuntu-latest to ubuntu-20.04
2022-12-04 19:39:25 -08:00
Ralf W. Grosse-Kunstleve
33fb7a6bd8 Show ODR VIOLATION DETECTED message only if PYBIND11_DETAIL_TYPE_CASTER_ODR_GUARD_IMPL_DEBUG is defined, to not clutter the test_gil_scoped.py output with many of these messages when multiprocessing.set_start_method("forkserver") is used. 2022-12-02 05:41:49 -08:00
Ralf W. Grosse-Kunstleve
13eb5eafd5 Changes related to PR #4285 (new style of warning suppression based on push/pop) 2022-12-02 05:30:03 -08:00
Ralf W. Grosse-Kunstleve
8f54f4f48c Tracking ci.yml changes from master. 2022-12-02 05:30:03 -08:00
Ralf W. Grosse-Kunstleve
10d4aa7476 Merge branch 'master' into sh_merge_master_3 2022-12-02 05:28:58 -08:00
Aaron Gokaslan
e133c33d5c
chore: Convert direct multiprocessing.set_start_method("forkserver") call to a pytest fixture. (#4377)
* chore: convert multiprocessing set_spawn to fixture in pytest

* Switch to early return
2022-12-01 15:15:47 -05:00
Ralf W. Grosse-Kunstleve
358ba459d2
Fix test added with PR #4330 (#4372) 2022-12-01 09:25:30 -08:00
dependabot[bot]
b14d58b615
chore(deps): bump pypa/gh-action-pypi-publish from 1.5.1 to 1.5.2 (#4370)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.5.1 to 1.5.2.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.5.1...v1.5.2)

---
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>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-30 23:30:36 -08:00
Arman
8869984926
scoped_interpreter. overloaded constructor: PyConfig param (#4330)
* scoped_interpreter overloaded ctor: PyConfig param

* style: pre-commit fixes

* refact: some logics extracted into funcs (precheck_interpreter, _initialize_interpreter); config_guard

* style: pre-commit fixes

* refact: scoped_config, some funcs hidden in detail ns

* refact: macro PYBIND11_PYCONFIG_SUPPORT_PY_VERSION + undef

* feat: PYBIND11_PYCONFIG_SUPPORT_PY_VERSION set to 3.8

* tests: Custom PyConfig

* ci: python 3.6 -> 3.8

* ci: reverted py 38 back  to 36; refact: initialize_interpreter overloads

* style: pre-commit fixes

* fix: readability-implicit-bool-conversion

* refact: each initialize_interpreter overloads in pybind11 ns

* Move `initialize_interpreter_pre_pyconfig()` into the `detail` namespace.

Move the `PYBIND11_PYCONFIG_SUPPORT_PY_VERSION_HEX` define down to where it is used for the first time, and check if it is defined already, so that it is possible to customize from the compilation command line, just in case there is some unforeseen issue for Python 3.8, 3.9, 3.10.

* tests: Add program dir to path, Custom PyConfig with argv

* refact: clang-formatted

* tests: Add-program-dir-to-path covers both scoped_interpreter overloads

* tests: Add-program-dir-to-path fixed

* tests: Add-program-dir-to-path py_version dependant validation

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>
2022-11-30 21:17:59 -08:00
Ralf W. Grosse-Kunstleve
8720cf94d6
cast.h return_value_policy_override _clif_automatic (#4364) 2022-11-28 11:10:37 -08:00
Ralf W. Grosse-Kunstleve
341bc8ac99
Add PYBIND11_HAS_RETURN_VALUE_POLICY_... defines. (#4352) 2022-11-28 11:10:03 -08:00
Ethan Steinberg
06003e82b3
Introduce a new style of warning suppression based on push/pop (#4285)
* Introduce a new warning suppression system

* Switch to better name

* Nits
2022-11-28 07:39:38 -08:00
Xuehai Pan
9907bedce5
fix(.github): fix bug-report issue template (#4363) 2022-11-25 15:15:54 -08:00
Ralf W. Grosse-Kunstleve
9c18a74e37
Use multiprocessing start_method "forkserver" (#4306)
* Use `multiprocessing` `start_method` `"forkserver"`

Alternative to PR #4305

* Add link to comment under PR #4105

* Unconditionally `pytest.skip("DEADLOCK")` for PyPy Windows

* Remove `SKIP_IF_DEADLOCK` entirely, for simplicity. Hopefully this PR will resolve the deadlocks for good.

* Add "In a nutshell" comment, in response to request by @EricCousineau-TRI
2022-11-22 17:17:02 -08:00
Ralf W. Grosse-Kunstleve
48949222c6
Use PyEval_InitThreads() as intended (#4350)
* Use `PyEval_InitThreads()` as intended (actually matters only for Python 3.6).

* Add `if defined(WITH_THREAD)` condition.

https://docs.python.org/3.6/c-api/init.html#c.PyEval_InitThreads

> This function is not available when thread support is disabled at compile time.

* Fix oversight pointed out by @EricCousineau-TRI: Remove condition that is always false.
2022-11-22 15:14:49 -08:00
Ralf W. Grosse-Kunstleve
d095a9bcff Tracking ci.yml changes from master. 2022-11-18 10:08:11 -08:00
Ralf W. Grosse-Kunstleve
645bcd47d0 Add macos_brew_install_llvm to ci.yml (#4326)
* Add macos_brew_install_llvm to ci.yml

Added block transferred from PR #4324

* `test_cross_module_exception_translator` xfail 'Homebrew Clang'

* Add `pip install numpy scipy` (tested already under PR #4324).
2022-11-18 10:08:11 -08:00
gitartpiano
4625adcbe5 fix pybind11Tools.cmake typo causing Unknown arguments (#4327)
* fix pybind11Tools.cmake typo causing Unknown arguments

CMake Error at pybind11/tools/pybind11Tools.cmake:217 (if):
  if given arguments:
    "NOT" "MSVC" "AND" "NOT" "TEST" "MATCHES" "DEBUG|RELWITHDEBINFO"
  Unknown arguments specified
https://github.com/pybind/pybind11/issues/4325

* Apply the same fix in tools/pybind11NewTools.cmake

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2022-11-18 10:08:11 -08:00
Ralf W. Grosse-Kunstleve
e76293d699 Add windows_clang to ci.yml (#4323)
* Add windows_clang to ci.yml (previously tested under PRs #4321, #4319)

* Add `pip install --upgrade pip`, Show env, cosmetic changes

Already tested under PR #4321
2022-11-18 10:08:11 -08:00
Ethan Steinberg
3cb7c254e6 Fix functional.h bug + introduce test to verify that it is fixed (#4254)
* 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>
2022-11-18 10:08:11 -08:00
Aaron Gokaslan
5b092eddde chore: sync blacken-docs hook with black (#4304) 2022-11-18 10:08:11 -08:00
pre-commit-ci[bot]
9bd8f656d3 chore(deps): update pre-commit hooks (#4302)
updates:
- [github.com/asottile/pyupgrade: v2.38.2 → v3.2.0](https://github.com/asottile/pyupgrade/compare/v2.38.2...v3.2.0)
- [github.com/psf/black: 22.8.0 → 22.10.0](https://github.com/psf/black/compare/22.8.0...22.10.0)
- [github.com/PyCQA/pylint: v2.15.3 → v2.15.5](https://github.com/PyCQA/pylint/compare/v2.15.3...v2.15.5)
- [github.com/pre-commit/mirrors-mypy: v0.981 → v0.982](https://github.com/pre-commit/mirrors-mypy/compare/v0.981...v0.982)
- [github.com/codespell-project/codespell: v2.2.1 → v2.2.2](https://github.com/codespell-project/codespell/compare/v2.2.1...v2.2.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-18 10:08:11 -08:00
Henry Schreiner
717aa08784 docs: prepare for 2.10.1 release (#4279)
* 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>
2022-11-18 10:08:11 -08:00
Ralf W. Grosse-Kunstleve
59b45e0abf fix: define (non-empty) PYBIND11_EXPORT_EXCEPTION only under macOS. (#4298)
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.
2022-11-18 10:08:11 -08:00
Ralf W. Grosse-Kunstleve
c3987b1aad fix: unicode surrogate character in Python exception message. (#4297)
* 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>
2022-11-18 10:08:11 -08:00
Xiaofei Wang
6d3a0fc319
Add return value policy _clif_automatic (#4343) 2022-11-18 08:55:10 -08:00
Ralf W. Grosse-Kunstleve
296615ad34
Add macos_brew_install_llvm to ci.yml (#4326)
* Add macos_brew_install_llvm to ci.yml

Added block transferred from PR #4324

* `test_cross_module_exception_translator` xfail 'Homebrew Clang'

* Add `pip install numpy scipy` (tested already under PR #4324).
2022-11-12 12:24:19 -08:00
gitartpiano
88b019a8a5
fix pybind11Tools.cmake typo causing Unknown arguments (#4327)
* fix pybind11Tools.cmake typo causing Unknown arguments

CMake Error at pybind11/tools/pybind11Tools.cmake:217 (if):
  if given arguments:
    "NOT" "MSVC" "AND" "NOT" "TEST" "MATCHES" "DEBUG|RELWITHDEBINFO"
  Unknown arguments specified
https://github.com/pybind/pybind11/issues/4325

* Apply the same fix in tools/pybind11NewTools.cmake

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2022-11-11 17:52:57 -08:00
Ralf W. Grosse-Kunstleve
1f04cc7062
Add windows_clang to ci.yml (#4323)
* Add windows_clang to ci.yml (previously tested under PRs #4321, #4319)

* Add `pip install --upgrade pip`, Show env, cosmetic changes

Already tested under PR #4321
2022-11-10 08:33:26 -08:00
Ethan Steinberg
ee2b522629
Fix functional.h bug + introduce test to verify that it is fixed (#4254)
* 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>
2022-11-02 11:32:53 -07:00
Aaron Gokaslan
0176632e8c
chore: sync blacken-docs hook with black (#4304) 2022-11-01 12:19:34 -04:00
pre-commit-ci[bot]
2441d25b26
chore(deps): update pre-commit hooks (#4302)
updates:
- [github.com/asottile/pyupgrade: v2.38.2 → v3.2.0](https://github.com/asottile/pyupgrade/compare/v2.38.2...v3.2.0)
- [github.com/psf/black: 22.8.0 → 22.10.0](https://github.com/psf/black/compare/22.8.0...22.10.0)
- [github.com/PyCQA/pylint: v2.15.3 → v2.15.5](https://github.com/PyCQA/pylint/compare/v2.15.3...v2.15.5)
- [github.com/pre-commit/mirrors-mypy: v0.981 → v0.982](https://github.com/pre-commit/mirrors-mypy/compare/v0.981...v0.982)
- [github.com/codespell-project/codespell: v2.2.1 → v2.2.2](https://github.com/codespell-project/codespell/compare/v2.2.1...v2.2.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-01 00:10:13 -04:00
Henry Schreiner
252ed8fb52
docs: prepare for 2.10.1 release (#4279)
* 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>
2022-10-31 14:11:23 -04:00
Ralf W. Grosse-Kunstleve
b1bd7f2600
fix: define (non-empty) PYBIND11_EXPORT_EXCEPTION only under macOS. (#4298)
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.
2022-10-31 13:36:26 -04:00
Ralf W. Grosse-Kunstleve
3a2c96bd6f
fix: unicode surrogate character in Python exception message. (#4297)
* 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>
2022-10-31 12:18:05 -04:00
Ralf W. Grosse-Kunstleve
fcdb9bae21 Tracking ci.yml changes from master. 2022-10-30 13:33:08 -07:00
Ralf W. Grosse-Kunstleve
4928b03bae Merge branch 'master' into sh_merge_master 2022-10-30 13:26:32 -07:00
Ralf W. Grosse-Kunstleve
5bc0943ed9
Ensure config, build, toolchain, spelling, etc. issues are not masked. (#4255) 2022-10-30 13:24:41 -07:00
Chekov2k
b07d08f600
Add PYBIND11_SIMPLE_GIL_MANAGEMENT option (cmake, C++ define) (#4216)
* 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>
2022-10-30 08:57:23 -07:00
Aaron Gokaslan
b07223fa69
fix: improve bytes to str decoding error handling (#4294)
* (bugfix): Improve bytes to str decoding error handling

* regroup test

* Further broaden tests

* Add another decode error test

* Fix bug in tests

* Reviewer suggestions
2022-10-29 11:12:24 -04:00
Henry Schreiner
fcb5554d9f
ci: move to final release of 3.11 (#4286)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-10-26 10:41:51 -04:00
Vemund Handeland
07a61aa1c0
Fix char8_t support (#4278)
Standard library macro __cpp_lib_char8_t is only available
after including standard header
2022-10-23 14:57:45 -04:00
Henry Schreiner
d1c31e9aa0
chore: improve issue template (#4276) 2022-10-23 08:08:00 -04:00
Henry Schreiner
4fe905d4f0
fix: add flag for overriding classic Python search values (#4195)
* fix: PyPy needs to overrite broken FindPythonInterp values

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

* fix: add flag to opt-in to new (cross-compile) behavior

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

* Apply suggestions from code review

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-10-23 00:32:17 -04:00
Lalaland
8ea75ab4d7
Fix casts to void* (#4275)
* 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>
2022-10-22 16:52:35 -07:00
Aaron Gokaslan
17c1e27b3d
fix: Revert pfect args make iterator (#4234)
* Revert "chore: perfectly forward all make_iterator args (#3980)"

This reverts commit 8da58da539.

* Redo unrelated optimization in commit

* Add tests for ambiguous overloads
2022-10-21 18:04:01 -04:00