Commit Graph

2839 Commits

Author SHA1 Message Date
Aaron Gokaslan
864ed1120c
chore: steal arg_v.value from copied arg in unpacking_collector (#4219) 2022-10-06 16:11:34 -04:00
Henry Schreiner
8275b76912
ci: update pre-commit schedule (#4212) 2022-10-04 14:01:26 -04:00
pre-commit-ci[bot]
600d697648
[pre-commit.ci] pre-commit autoupdate (#4210)
updates:
- [github.com/pre-commit/mirrors-mypy: v0.971 → v0.981](https://github.com/pre-commit/mirrors-mypy/compare/v0.971...v0.981)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-03 21:25:46 -04:00
Aaron Gokaslan
c78dfe6964
bugfix: Add error checking to list append and insert (#4208) 2022-10-03 13:44:09 -04:00
pre-commit-ci[bot]
da8c730a62
[pre-commit.ci] pre-commit autoupdate (#4197)
updates:
- [github.com/asottile/pyupgrade: v2.38.0 → v2.38.2](https://github.com/asottile/pyupgrade/compare/v2.38.0...v2.38.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-09-26 20:44:19 -04:00
Aaron Gokaslan
5aa0fad5de
perf: call reserve method in set and map casters (#4194)
* Call reserve method in set and map casters too

* Refactor template logic into has_reserve_method

* Adjust comment for reviews

* Rearrange reserve_maybe to not be underneath macro
2022-09-25 16:10:57 -04:00
bogdan-lab
f743bdf8e6
Avoid local_internals destruction (#4192)
* Avoid local_internals destruction

It allows to avoid possible static deinitialization fiasco.

* Add link to relevant google style guide discussion
2022-09-21 11:50:31 -07:00
Aaron Gokaslan
95d0e71a65
test C++14 on MSVC (#4191) 2022-09-21 11:20:07 -04:00
Jan Iwaszkiewicz
424ac4fe1b
fix: Windows compiler, missing object initializer (#4188)
* Fix for windows compiler, missing object initializer

* Removal of if-else macro for MSVC
2022-09-20 13:03:57 -04:00
pre-commit-ci[bot]
d02f219fb9
[pre-commit.ci] pre-commit autoupdate (#4189)
updates:
- [github.com/asottile/pyupgrade: v2.37.3 → v2.38.0](https://github.com/asottile/pyupgrade/compare/v2.37.3...v2.38.0)
- [github.com/PyCQA/pylint: v2.15.2 → v2.15.3](https://github.com/PyCQA/pylint/compare/v2.15.2...v2.15.3)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-09-19 21:11:57 -04:00
Aaron Gokaslan
9c04c7b0f1
chore: Delete copy ctor/assign for GIL RAIIs (#4183)
* chore: Delete copy ctor/assign for GIL RAIIs

* Fix typo

* Delete copy ops for local gil scoped acquire
2022-09-19 12:56:31 -04:00
Dustin Spicuzza
1874f8fa87
Clarify GIL documentation (#4057) 2022-09-14 14:00:27 -07:00
Sergei Izmailov
8524b20c3c
fix: Python-3.12 compatibility (#4168)
* fix: Python-3.12 compatibility

Enable dynamic attributes for `pybind11_static_property`

* Add future-notice comment
2022-09-14 13:56:40 -07:00
pre-commit-ci[bot]
64f7281874
[pre-commit.ci] pre-commit autoupdate (#4178)
updates:
- [github.com/PyCQA/pylint: v2.15.0 → v2.15.2](https://github.com/PyCQA/pylint/compare/v2.15.0...v2.15.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-09-12 20:04:44 -04:00
pre-commit-ci[bot]
aa8f8baa4e
[pre-commit.ci] pre-commit autoupdate (#4171)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 22.6.0 → 22.8.0](https://github.com/psf/black/compare/22.6.0...22.8.0)

* Update .pre-commit-config.yaml

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2022-09-07 09:19:02 -04:00
pre-commit-ci[bot]
8756f16ed8
[pre-commit.ci] pre-commit autoupdate (#4151)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/Lucas-C/pre-commit-hooks: v1.3.0 → v1.3.1](https://github.com/Lucas-C/pre-commit-hooks/compare/v1.3.0...v1.3.1)
- [github.com/sirosen/texthooks: 0.3.1 → 0.4.0](https://github.com/sirosen/texthooks/compare/0.3.1...0.4.0)
- [github.com/PyCQA/pylint: v2.14.5 → v2.15.0](https://github.com/PyCQA/pylint/compare/v2.14.5...v2.15.0)
- [github.com/codespell-project/codespell: v2.1.0 → v2.2.1](https://github.com/codespell-project/codespell/compare/v2.1.0...v2.2.1)

* Introduce .codespell-ignore-lines for safer (line-based instead of word-based) suppressions.

* Fix two issues: 1. ensure sort order; 2. remove duplicates

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-08-29 21:59:48 -07:00
dependabot[bot]
283f10dc55
chore(deps): bump ilammy/msvc-dev-cmd from 1.10.0 to 1.11.0 (#4161)
Bumps [ilammy/msvc-dev-cmd](https://github.com/ilammy/msvc-dev-cmd) from 1.10.0 to 1.11.0.
- [Release notes](https://github.com/ilammy/msvc-dev-cmd/releases)
- [Commits](https://github.com/ilammy/msvc-dev-cmd/compare/v1.10.0...v1.11.0)

---
updated-dependencies:
- dependency-name: ilammy/msvc-dev-cmd
  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-08-29 23:26:53 -04:00
Axel Huebl
0b4c1bc286
test: ConstructorStats newline (PyPy) (#4167)
This looks like it lacks a newline.
2022-08-29 23:25:01 -04:00
Ralf W. Grosse-Kunstleve
fac23b6f65
error_fetch_and_normalize: PyPy 7.3.10+ does not need the PR #4079 workaround anymore. (#4154) 2022-08-24 13:08:24 -07:00
Brad Messer
a48ec3e882
Words matter updates (#4155)
* Remove sanity check from code base.

* Use main over master.

* Better alternative that doesn't collide with language keywords/frequent usage words.
2022-08-24 07:34:31 -07:00
Ralf W. Grosse-Kunstleve
68e6fdaa90
embed.h Python 3.11 config.use_environment=1 + PYTHONPATH test (#4119)
* Add debug fprintf to test_interpreter.cpp

* Update `sys.path` from `PYTHONPATH` in Python >= 3.11 branch of `initialize_interpreter()`

* Use `config.isolated = 0; config.use_environment = 1;`

As suggsted by @vstinner here: https://github.com/pybind/pybind11/pull/4119#issuecomment-1219442853

* Add `TEST_CASE("PYTHONPATH is used to update sys.path")`

* Fix clang-tidy error.

* Use `_putenv_s()` under Windows.

* Fix clang-tidy error: argument name ... in comment does not match parameter name

* Remove slash from PYTHONPATH addition, to work around Windows slash-vs-backslash issue.

* Use `py::str(...)` instead of `.attr("__str__")` as suggested by @skylion007

Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>

Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
2022-08-21 09:44:01 -07:00
Aaron Gokaslan
81f35d29c6
chore: Mark detail:forward_like as constexpr (#4147) 2022-08-20 17:05:07 -04:00
Stephan T. Lavavej
2d59b43cbf
Qualify detail::forward_like to avoid conflict. (#4136)
C++23 feature: P2445R1 forward_like()
2022-08-11 21:19:39 -07:00
Aaron Gokaslan
b884b9dc6b
chore: Add pytests for constructing pytypes from iterable (#4138)
* Add some additional pytests

* Reorder tests

* Further reorder tests

* remove stray lines

* remove unused fixtures
2022-08-11 16:14:17 -04:00
Henry Schreiner
bbb89da152
fix(cmake): support vcpkg, try 2 (#4123)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-08-09 00:03:36 -04:00
Eli Schwartz
5bdd3d59be
feat(cmake): add installation support for pkg-config dependency detection (#4077)
* add installation support for pkg-config dependency detection

pkg-config is a buildsystem-agnostic alternative to
`pybind11Config.cmake` that can be used from build systems other than
cmake.

Fixes #230

* tests: add test for pkg config

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

Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-08-09 00:02:45 -04:00
pre-commit-ci[bot]
14c84654f8
[pre-commit.ci] pre-commit autoupdate (#4126)
updates:
- [github.com/asottile/yesqa: v1.3.0 → v1.4.0](https://github.com/asottile/yesqa/compare/v1.3.0...v1.4.0)
- [github.com/PyCQA/flake8: 5.0.2 → 5.0.4](https://github.com/PyCQA/flake8/compare/5.0.2...5.0.4)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-08-08 21:15:43 -04:00
Aaron Gokaslan
6abb7de6cd
chore: Use PyObject_GenericGetDict and PyObject_GenericSetDict functions (#4106)
* Try to update getset_dict APIs for 3.11

* Update API for all Python versions

* Test ifdef for forward explicit forward compat

* Fix ifdef
2022-08-08 14:28:33 -04:00
Daniel Dinu
8a4bca8216
fix(cmake): use case-insensitive CMAKE_BUILD_TYPE comparisons (#4078) 2022-08-08 10:01:39 -04:00
Ralf W. Grosse-Kunstleve
29f4940cd4
Fix copy-paste oversight (#4118) 2022-08-05 08:05:40 -07:00
pre-commit-ci[bot]
ba5ccd845a
[pre-commit.ci] pre-commit autoupdate (#4104)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/asottile/pyupgrade: v2.37.2 → v2.37.3](https://github.com/asottile/pyupgrade/compare/v2.37.2...v2.37.3)
- [github.com/hadialqattan/pycln: v2.0.4 → v2.1.1](https://github.com/hadialqattan/pycln/compare/v2.0.4...v2.1.1)
- [github.com/PyCQA/flake8: 4.0.1 → 5.0.2](https://github.com/PyCQA/flake8/compare/4.0.1...5.0.2)

* fix: minor touchups for flake8

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

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-08-03 11:38:07 -04:00
Aaron Gokaslan
88a1bb9260
chore: remove unnecessary temporary std::pair (#4103) 2022-08-01 15:48:44 -04:00
Thomas Eding
f8e8403b85
Open pybind11 namespace with consistent visility. (#4098) 2022-08-01 11:31:31 -07:00
pre-commit-ci[bot]
aa953710c1
[pre-commit.ci] pre-commit autoupdate (#4090)
updates:
- [github.com/asottile/pyupgrade: v2.37.1 → v2.37.2](https://github.com/asottile/pyupgrade/compare/v2.37.1...v2.37.2)
- [github.com/pre-commit/mirrors-mypy: v0.961 → v0.971](https://github.com/pre-commit/mirrors-mypy/compare/v0.961...v0.971)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-08-01 12:18:42 -04:00
Ralf W. Grosse-Kunstleve
3665530264
Add -DPYBIND11_WERROR=ON to mingw cmake commands (#4073)
* Add `-DPYBIND11_WERROR=ON` to mingw cmake commands (and `-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON`).

* Using no-destructor idiom to side-step overzealous MINGW warning.

* Add __MINGW32__ pragma GCC diagnostic ignored in eigen.h

* Add another no-destructor workaround.

* Temporarily add -k (keep-going) flags to hopefully speed up finding all warnings.

* Revert "Temporarily add -k (keep-going) flags to hopefully speed up finding all warnings."

This reverts commit f36b0af8f9.

* Very minor shuffle to avoid MSVC warnings.

* Remove all `:BOOL` as suggested by @henryiii
2022-08-01 06:18:48 -07:00
dependabot[bot]
1e3400b674
chore(deps): bump pypa/gh-action-pypi-publish from 1.5.0 to 1.5.1 (#4091)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.5.0 to 1.5.1.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.5.0...v1.5.1)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-28 21:37:47 -04:00
Hyunwook Choi
d70f54b073
docs: Missing semicolons (#4094)
Add semicolons to Memory view sample code
2022-07-27 10:41:57 -07:00
Aaron Gokaslan
b07975f492
Fix missing undef in pytypes (#4087) 2022-07-22 11:52:01 -04:00
Ralf W. Grosse-Kunstleve
9a2963734d
More systematic gcc & clang coverage (#4083)
* More systematic gcc coverage, based on https://github.com/pybind/pybind11/pull/4074#issuecomment-1188385580

* Fix complete fail.

* Resolve GCC 11 & 12 "redundant move in return statement" warnings.

* Also add clang 11, 12, 13 (to gather info for warning suppressions).

* Add & use `PYBIND11_DETECTED_CLANG_WITH_MISLEADING_CALL_STD_MOVE_EXPLICITLY_WARNING`
2022-07-21 06:40:34 -07:00
Ralf W. Grosse-Kunstleve
cb35a3c143
For PyPy only, re-enable old behavior (runs the risk of masking bugs) (#4079)
* For PyPy only, re-enable old behavior (likely to mask bugs), to avoid segfault with unknown root cause.

Change prompted by https://github.com/pybind/pybind11/issues/4075

* Undo the change in tests/test_exceptions.py

I turns out (I forgot) that PyPy segfaults in `test_flaky_exception_failure_point_init` already before the `MISMATCH` code path is reached:

https://github.com/pybind/pybind11/runs/7383663596

```
RPython traceback:
test_exceptions.py .......X.........Error in cpyext, CPython compatibility layer:
  File "pypy_module_cpyext.c", line 14052, in wrapper_second_level__star_3_1
  File "pypy_module_cpyext_1.c", line 35750, in not_supposed_to_fail
Fatal Python error: Segmentation fault
Stack (most recent call first, approximate line numbers):
  File "/home/runner/work/pybind11/pybind11/tests/test_exceptions.py", line 306 in test_flaky_exception_failure_point_init
The function PyErr_NormalizeException was not supposed to fail
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/_pytest/python.py", line 185 in pytest_pyfunc_call
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/pluggy/_callers.py", line 9 in _multicall
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/pluggy/_manager.py", line 77 in _hookexec
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/pluggy/_hooks.py", line 244 in __call__
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/_pytest/python.py", line 1716 in runtest
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/_pytest/runner.py", line 159 in pytest_runtest_call
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/pluggy/_callers.py", line 9 in _multicall
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/pluggy/_manager.py", line 77 in _hookexec
Fatal error in cpyext, CPython compatibility layer, calling PyErr_NormalizeException
Either report a bug or consider not using this particular extension
<SystemError object at 0x7fcc8cea6868>
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/pluggy/_hooks.py", line 244 in __call__
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/_pytest/runner.py", line 261 in <lambda>
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/_pytest/runner.py", line 317 in from_call
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/_pytest/runner.py", line 246 in call_runtest_hook
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/_pytest/runner.py", line 218 in call_and_report
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/_pytest/runner.py", line 118 in runtestprotocol
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/_pytest/runner.py", line 110 in pytest_runtest_protocol
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/pluggy/_callers.py", line 9 in _multicall
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/pluggy/_manager.py", line 77 in _hookexec
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/pluggy/_hooks.py", line 244 in __call__
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/_pytest/main.py", line 335 in pytest_runtestloop
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/pluggy/_callers.py", line 9 in _multicall
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/pluggy/_manager.py", line 77 in _hookexec
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/pluggy/_hooks.py", line 244 in __call__
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/_pytest/main.py", line 318 in _main
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/_pytest/main.py", line 255 in wrap_session
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/_pytest/main.py", line 314 in pytest_cmdline_main
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/pluggy/_callers.py", line 9 in _multicall
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/pluggy/_manager.py", line 77 in _hookexec
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/pluggy/_hooks.py", line 244 in __call__
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/_pytest/config/__init__.py", line 133 in main
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/_pytest/config/__init__.py", line 181 in console_main
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/pytest/__main__.py", line 1 in <module>
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/lib-python/3/runpy.py", line 62 in _run_code
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/lib-python/3/runpy.py", line 170 in _run_module_as_main
  File "<builtin>/app_main.py", line 109 in run_toplevel
  File "<builtin>/app_main.py", line 652 in run_command_line
  File "<builtin>/app_main.py", line 996 in entry_point
Segmentation fault (core dumped)
```

* Add test_pypy_oserror_normalization

* Disable new `PYPY_VERSION` `#if`, to verify that the new test actually fails.

* Restore PYPY_VERSION workaround and update comment to reflect what was learned.

* [ci skip] Fix trivial oversight in comment.
2022-07-21 06:38:00 -07:00
Aaron Gokaslan
42b54507ea
chore: use explicit defaulting in pyobject macros (#4017)
* Use equals default in pyobject macros

* Remove extra semicolon

* Update clang-tidy equals-default rule to not ignore macros

* Fix formatting

* One last formatting change
2022-07-20 12:02:20 -04:00
Aaron Gokaslan
f47f1edfe8
Fix #3812 and fix const of inplace assignments (#4065)
* Fix #3812 and fix const of inplace assignments

* Fix missing tests

* Revert operator overloading changes

* calculate answer first for tests

* Simplify tests

* Add more tests

* Add a couple more tests

* Add test_inplace_lshift, test_inplace_rshift for completeness.

* Update tests

* Shortcircuit on self assigment and address reviewer comment

* broaden skip for self assignment

* One more reviewer comment

* Document opt behavior and make consistent

* Revert unnecessary change

* Clarify comment

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2022-07-20 11:42:24 -04:00
pre-commit-ci[bot]
ef7d971e03
[pre-commit.ci] pre-commit autoupdate (#4082)
updates:
- [github.com/hadialqattan/pycln: v2.0.1 → v2.0.4](https://github.com/hadialqattan/pycln/compare/v2.0.1...v2.0.4)
- [github.com/PyCQA/pylint: v2.14.4 → v2.14.5](https://github.com/PyCQA/pylint/compare/v2.14.4...v2.14.5)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-07-18 19:39:10 -05:00
Henry Schreiner
59f03ee389 tests: include pypy3.9 in nox if present
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-07-15 22:22:51 -05:00
Henry Schreiner
5116a629e9 fix(spelling): PYTHON_VERSIONS 2022-07-15 22:22:51 -05:00
Henry Schreiner
8d82f29887 chore: back to work
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-07-15 22:22:51 -05:00
Henry Schreiner
aa304c9c7d
chore: preapre for 2.10.0 release (#4068)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-07-15 15:47:47 -05:00
Henry Schreiner
87f64c4321
docs: update changelog for 2.10.0 (#4066) 2022-07-15 13:45:16 -05:00
Ralf W. Grosse-Kunstleve
1d81191077
Disable implicit conversion of 0 to pybind11::handle. (#4008)
* Disable implicit conversion from `0` to `pybind11::handle`.

* Reverse or-ed condition in an attempt to resolve GCC 8.3.0 errors (i386/debian:buster).

* Trying the simpler `std::is_same<T, PyObject *>`

* Add implicit_conversion_from_pytorch_THPObjectPtr_to_handle test.

* Accommodate types with implicit conversions to `PyObject *`, other than `handle` & `handle` subclasses, or integral types.

* Fix copy-paste mishap (picked wrong name).

* Revamp SFINAE construct to actually fix the pytorch issue (already validated against pytorch proper).

The first version of the reduced pytorch code was critically missing the move ctor. The first version of the accompanying test was meaningless.

Note: It turns out the `!std::is_arithmetic<T>` condition is not needed: `int` is not in general implicitly convertible to `PyObject *`, only the literal `0` is.

* Use `NOLINT(performance-noexcept-move-constructor)` for reduced code from the wild (rather than changing the code).

* Use any_of, all_of, negation. It turns out to clang-format nicer.

* Clean up comments for changed code.

* Reduce pytorch situation further, add test for operator ... const.

* Use `none_of` as suggested by @skylion007

* Add `pure_compile_tests_for_handle_from_PyObject_pointers()`

* Fix inconsequential oversight (retested).

* Factor our `is_pyobj_ptr_or_nullptr_t` to make the SFINAE conditions more readable.

* Remove stray line (oversight).

* Make the `pure_compile_tests_for_handle_from_PyObject_pointers()` "rhs-const-complete", too.

* Remove the temporary PYBIND11_UNDO_PR4008 `#ifdef`.
2022-07-14 09:53:39 -07:00
Aaron Gokaslan
bc9315fe38
chore: optimize sparse matrix casting with python tuple (#4064)
* optimize casting of sparse Eigen arrays

* move array

* Revert for safety
2022-07-13 19:27:00 -04:00