pybind11/include/pybind11
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
..
detail Properly visit self in >=3.9 traverse (#4051) 2022-07-09 21:43:53 -07:00
stl feature: support compilers that use std::experimental::filesystem (#3840) 2022-03-31 22:16:10 -07:00
attr.h Fix: 3.11 beta support (#3923) 2022-07-06 16:35:12 -04:00
buffer_info.h Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
cast.h Undo accidental one-line change under PR #3913 (#4060) 2022-07-12 12:02:20 -07:00
chrono.h chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
common.h Add a dummy common.h header with a deprecation warning 2017-09-06 15:22:26 +02:00
complex.h Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
eigen.h chore: optimize sparse matrix casting with python tuple (#4064) 2022-07-13 19:27:00 -04:00
embed.h Fix: 3.11 beta support (#3923) 2022-07-06 16:35:12 -04:00
eval.h fix: missing move in eval.h (#3775) 2022-03-02 15:25:43 -05:00
functional.h remove useless ctor (#3989) 2022-06-03 15:18:06 -04:00
gil.h Replace error printing code gated by NDEBUG with a new flag: PYBIND11_DETAILED_ERROR_MESSAGES (#3913) 2022-05-02 15:30:19 -04:00
iostream.h chore: add err guard to capsule destructor and add a move to iostream (#3958) 2022-05-27 14:32:57 -04:00
numpy.h Add a missing std::move in numpy.h (#4005) 2022-06-14 14:20:26 -04:00
operators.h Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
options.h Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
pybind11.h error_already_set::what() is now constructed lazily (#1895) 2022-06-02 16:17:38 -07:00
pytypes.h Disable implicit conversion of 0 to pybind11::handle. (#4008) 2022-07-14 09:53:39 -07:00
stl_bind.h chore: Make stl_bind take slice as const_ref (#3852) 2022-04-11 13:53:30 -04:00
stl.h perf: Add object rvalue overload for accessors. Enables reference stealing (#3970) 2022-06-01 15:19:13 -04:00