pybind11/tests
Michael Kuron 48534089f7
fix: Intel ICC C++17 compatibility (#2729)
* CI: Intel icc/icpc via oneAPI

Add testing for Intel icc/icpc via the oneAPI images.
Intel oneAPI is in a late beta stage, currently shipping
oneAPI beta09 with ICC 20.2.

CI: Skip Interpreter Tests for Intel

Cannot find how to add this, neiter the package `libc6-dev` nor
`intel-oneapi-mkl-devel` help when installed to solve this:
```
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - not found
CMake Error at /__t/cmake/3.18.4/x64/cmake-3.18.4-Linux-x86_64/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
  Could NOT find Threads (missing: Threads_FOUND)
Call Stack (most recent call first):
  /__t/cmake/3.18.4/x64/cmake-3.18.4-Linux-x86_64/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
  /__t/cmake/3.18.4/x64/cmake-3.18.4-Linux-x86_64/share/cmake-3.18/Modules/FindThreads.cmake:234 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  tests/test_embed/CMakeLists.txt:17 (find_package)
```

CI: libc6-dev from GCC for ICC

CI: Run bare metal for oneAPI

CI: Ubuntu 18.04 for oneAPI

CI: Intel +Catch -Eigen

CI: CMake from Apt (ICC tests)

CI: Replace Intel Py with GCC Py

CI: Intel w/o GCC's Eigen

CI: ICC with verbose make

[Debug] Find core dump

tests: use arg{} instead of arg() for Intel

tests: adding a few more missing {}

fix: sync with @tobiasleibner's branch

fix: try ubuntu 20-04

fix: drop exit 1

docs: Apply suggestions from code review

Co-authored-by: Tobias Leibner <tobias.leibner@googlemail.com>

Workaround for ICC enable_if issues

Another workaround for ICC's enable_if issues

fix error in previous commit

Disable one test for the Intel compiler in C++17 mode

Add back one instance of py::arg().noconvert()

Add NOLINT to fix clang-tidy check

Work around for ICC internal error in PYBIND11_EXPAND_SIDE_EFFECTS in C++17 mode

CI: Intel ICC with C++17

docs: pybind11/numpy.h does not require numpy at build time. (#2720)

This is nice enough to be mentioned explicitly in the docs.

docs: Update warning about Python 3.9.0 UB, now that 3.9.1 has been released (#2719)

Adjusting `type_caster<std::reference_wrapper<T>>` to support const/non-const propagation in `cast_op`. (#2705)

* Allow type_caster of std::reference_wrapper<T> to be the same as a native reference.

Before, both std::reference_wrapper<T> and std::reference_wrapper<const T> would
invoke cast_op<type>. This doesn't allow the type_caster<> specialization for T
to distinguish reference_wrapper types from value types.

After, the type_caster<> specialization invokes cast_op<type&>, which allows
reference_wrapper to behave in the same way as a native reference type.

* Add tests/examples for std::reference_wrapper<const T>

* Add tests which use mutable/immutable variants

This test is a chimera; it blends the pybind11 casters with a custom
pytype implementation that supports immutable and mutable calls.

In order to detect the immutable/mutable state, the cast_op needs
to propagate it, even through e.g. std::reference<const T>

Note: This is still a work in progress; some things are crashing,
which likely means that I have a refcounting bug or something else
missing.

* Add/finish tests that distinguish const& from &

Fixes the bugs in my custom python type implementation,
demonstrate test that requires const& and reference_wrapper<const T>
being treated differently from Non-const.

* Add passing a const to non-const method.

* Demonstrate non-const conversion of reference_wrapper in tests.

Apply formatting presubmit check.

* Fix build errors from presubmit checks.

* Try and fix a few more CI errors

* More CI fixes.

* More CI fixups.

* Try and get PyPy to work.

* Additional minor fixups. Getting close to CI green.

* More ci fixes?

* fix clang-tidy warnings from presubmit

* fix more clang-tidy warnings

* minor comment and consistency cleanups

* PyDECREF -> Py_DECREF

* copy/move constructors

* Resolve codereview comments

* more review comment fixes

* review comments: remove spurious &

* Make the test fail even when the static_assert is commented out.

This expands the test_freezable_type_caster a bit by:
1/ adding accessors .is_immutable and .addr to compare identity
from python.
2/ Changing the default cast_op of the type_caster<> specialization
to return a non-const value. In normal codepaths this is a reasonable
default.
3/ adding roundtrip variants to exercise the by reference, by pointer
and by reference_wrapper in all call paths.  In conjunction with 2/, this
demonstrates the failure case of the existing std::reference_wrpper conversion,
which now loses const in a similar way that happens when using the default cast_op_type<>.

* apply presubmit formatting

* Revert inclusion of test_freezable_type_caster

There's some concern that this test is a bit unwieldly because of the use
of the raw <Python.h> functions. Removing for now.

* Add a test that validates const references propagation.

This test verifies that cast_op may be used to correctly detect
const reference types when used with std::reference_wrapper.

* mend

* Review comments based changes.

1. std::add_lvalue_reference<type> -> type&
2. Simplify the test a little more; we're never returning the ConstRefCaster
type so the class_ definition can be removed.

* formatted files again.

* Move const_ref_caster test to builtin_casters

* Review comments: use cast_op and adjust some comments.

* Simplify ConstRefCasted test

I like this version better as it moves the assertion that matters
back into python.

ci: drop pypy2 linux, PGI 20.7, add Python 10 dev (#2724)

* ci: drop pypy2 linux, add Python 10 dev

* ci: fix mistake

* ci: commented-out PGI 20.11, drop 20.7

fix: regression with installed pybind11 overriding local one (#2716)

* fix: regression with installed pybind11 overriding discovered one

Closes #2709

* docs: wording incorrect

style: remove redundant instance->owned = true (#2723)

which was just before set to True in instance->allocate_layout()

fix: also throw in the move-constructor added by the PYBIND11_OBJECT macro, after the argument has been moved-out (if necessary) (#2701)

Make args_are_all_* ICC workarounds unconditional

Disable test_aligned on Intel ICC

Fix test_aligned on Intel ICC

Skip test_python_alreadyset_in_destructor on Intel ICC

Fix test_aligned again

ICC CI: Downgrade pytest

pytest 6 does not capture the `discard_as_unraisable` stderr and
just writes a warning with its content instead.

* refactor: simpler Intel workaround, suggested by @laramiel

* fix: try version with impl to see if it is easier to compile

* docs: update README for ICC

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2021-01-17 19:53:07 -05:00
..
extra_python_package feat: typing support for helpers (#2588) 2020-10-14 14:08:41 -04:00
extra_setuptools feat: parallel compiler (#2521) 2020-10-02 10:03:35 -04:00
test_cmake_build refactor: module -> module_ with typedef (#2544) 2020-10-03 13:38:03 -04:00
test_embed style: clang-tidy: modernize-use-using (#2645) 2020-11-09 10:10:19 -08:00
CMakeLists.txt Add a Valgrind build on debug Python 3.9 (#2746) 2021-01-15 21:07:31 +01:00
conftest.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
constructor_stats.h refactor: module -> module_ with typedef (#2544) 2020-10-03 13:38:03 -04:00
cross_module_gil_utils.cpp Make sure `detail::get_internals` acquires the GIL before making Python calls. (#1836) 2019-07-15 16:47:02 +02:00
env.py ci: reduce flakiness a little (#2418) 2020-08-20 11:58:34 -04:00
local_bindings.h style: clang-tidy: llvm-namespace-comment 2020-09-15 09:56:59 -04:00
object.h Improve custom holder support (#607) 2017-01-31 17:05:44 +01:00
pybind11_cross_module_tests.cpp Make TypeErrors more informative when an optional header is missing 2017-09-12 08:06:46 +02:00
pybind11_tests.cpp refactor: module -> module_ with typedef (#2544) 2020-10-03 13:38:03 -04:00
pybind11_tests.h Ignore deprecation warnings about old-style __init__/__setstate__ constructors in the tests (originally done in #2746) (#2759) 2021-01-01 17:37:28 +01:00
pytest.ini feat: setup.py redesign and helpers (#2433) 2020-09-16 17:13:41 -04:00
requirements.txt Add a Valgrind build on debug Python 3.9 (#2746) 2021-01-15 21:07:31 +01:00
test_async.cpp refactor: module -> module_ with typedef (#2544) 2020-10-03 13:38:03 -04:00
test_async.py tests: cleanup and ci hardening (#2397) 2020-08-16 16:02:12 -04:00
test_buffers.cpp style: ssize_t -> py::ssize_t 2020-10-15 17:38:49 -04:00
test_buffers.py Fix various minor memory leaks in the tests (found by Valgrind in #2746) (#2758) 2021-01-01 17:05:22 +01:00
test_builtin_casters.cpp fix: Intel ICC C++17 compatibility (#2729) 2021-01-17 19:53:07 -05:00
test_builtin_casters.py fix: only allow integer type_caster to call __int__ method when conversion is allowed; always call __index__ (#2698) 2021-01-16 20:52:14 -05:00
test_call_policies.cpp ci: fix clang warnings 2020-07-26 09:25:27 -04:00
test_call_policies.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_callbacks.cpp fix: Intel ICC C++17 compatibility (#2729) 2021-01-17 19:53:07 -05:00
test_callbacks.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_chrono.cpp fix: allow assignment of time points of resolutions other than that of a system clock (#2481) 2020-09-13 10:24:00 -04:00
test_chrono.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_class.cpp fix: Intel ICC C++17 compatibility (#2729) 2021-01-17 19:53:07 -05:00
test_class.py fix: test_factory_constructors.py failure triggered by test_register_duplicate_class (#2564) 2020-10-16 16:38:51 -04:00
test_constants_and_functions.cpp fix: Intel ICC C++17 compatibility (#2729) 2021-01-17 19:53:07 -05:00
test_constants_and_functions.py Plug leaking function_records in cpp_function initialization in case of exceptions (found by Valgrind in #2746) (#2756) 2021-01-14 19:34:32 +01:00
test_copy_move.cpp Fix various minor memory leaks in the tests (found by Valgrind in #2746) (#2758) 2021-01-01 17:05:22 +01:00
test_copy_move.py Fix various minor memory leaks in the tests (found by Valgrind in #2746) (#2758) 2021-01-01 17:05:22 +01:00
test_custom_type_casters.cpp ci: Intel icc/icpc via oneAPI (#2573) 2021-01-15 15:59:47 -05:00
test_custom_type_casters.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_docstring_options.cpp fix: do not set docstring for function when empty (#2745) 2020-12-27 22:56:30 -05:00
test_docstring_options.py fix: do not set docstring for function when empty (#2745) 2020-12-27 22:56:30 -05:00
test_eigen.cpp ci: Intel icc/icpc via oneAPI (#2573) 2021-01-15 15:59:47 -05:00
test_eigen.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_enum.cpp Avoid conversion to `int_` rhs argument of enum eq/ne (#1912) 2019-09-19 18:23:27 +02:00
test_enum.py enum: add missing Enum.value property (#2739) 2020-12-31 11:08:15 -05:00
test_eval.cpp Add __builtins__ to globals argument of `py::exec` and `py::eval` if not present (#2616) 2020-10-27 19:58:27 +01:00
test_eval.py Add __builtins__ to globals argument of `py::exec` and `py::eval` if not present (#2616) 2020-10-27 19:58:27 +01:00
test_eval_call.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_exceptions.cpp clang -Wnon-virtual-dtor compatibility (#2626) 2020-10-29 06:12:14 -07:00
test_exceptions.py tests: update pytest 6.2.1 and fix test_python_alreadyset_in_destructor (#2741) 2020-12-24 09:53:23 -05:00
test_factory_constructors.cpp Ignore deprecation warnings about old-style __init__/__setstate__ constructors in the tests (originally done in #2746) (#2759) 2021-01-01 17:37:28 +01:00
test_factory_constructors.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_gil_scoped.cpp refactor: module -> module_ with typedef (#2544) 2020-10-03 13:38:03 -04:00
test_gil_scoped.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_iostream.cpp pythonbuf fix (#2675) 2020-11-19 12:09:33 +01:00
test_iostream.py pythonbuf fix (#2675) 2020-11-19 12:09:33 +01:00
test_kwargs_and_defaults.cpp style: ssize_t -> py::ssize_t 2020-10-15 17:38:49 -04:00
test_kwargs_and_defaults.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_local_bindings.cpp refactor: module -> module_ with typedef (#2544) 2020-10-03 13:38:03 -04:00
test_local_bindings.py minor cleanup: fixing or silencing flake8 errors (#2731) 2020-12-18 19:41:43 -05:00
test_methods_and_attributes.cpp ci: Intel icc/icpc via oneAPI (#2573) 2021-01-15 15:59:47 -05:00
test_methods_and_attributes.py Allow NULL value in pybind11_meta_setattro (#2629) 2020-11-05 23:54:37 +01:00
test_modules.cpp feat: deprecate public constructors of module_ class (#2552) 2020-10-09 10:46:11 -04:00
test_modules.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_multiple_inheritance.cpp chore: drop support for PyPy < 7.3.1 and clean up old PyPy workarounds (#2456) 2020-10-05 10:43:27 -04:00
test_multiple_inheritance.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_numpy_array.cpp ci: Intel icc/icpc via oneAPI (#2573) 2021-01-15 15:59:47 -05:00
test_numpy_array.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_numpy_dtypes.cpp style: ssize_t -> py::ssize_t 2020-10-15 17:38:49 -04:00
test_numpy_dtypes.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_numpy_vectorize.cpp style: ssize_t -> py::ssize_t 2020-10-15 17:38:49 -04:00
test_numpy_vectorize.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_opaque_types.cpp Allow raw unions without base classes in is_accessible_base_of (#2320) 2020-10-02 09:39:22 -04:00
test_opaque_types.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_operator_overloading.cpp fix: AppleClang 12 warnings (#2510) 2020-09-19 20:23:47 +02:00
test_operator_overloading.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_pickling.cpp Ignore deprecation warnings about old-style __init__/__setstate__ constructors in the tests (originally done in #2746) (#2759) 2021-01-01 17:37:28 +01:00
test_pickling.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_pytypes.cpp fix: also throw in the move-constructor added by the PYBIND11_OBJECT macro, after the argument has been moved-out (if necessary) (#2701) 2020-12-15 23:22:53 -05:00
test_pytypes.py fix: also throw in the move-constructor added by the PYBIND11_OBJECT macro, after the argument has been moved-out (if necessary) (#2701) 2020-12-15 23:22:53 -05:00
test_sequences_and_iterators.cpp style: ssize_t -> py::ssize_t 2020-10-15 17:38:49 -04:00
test_sequences_and_iterators.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_smart_ptr.cpp Fix various minor memory leaks in the tests (found by Valgrind in #2746) (#2758) 2021-01-01 17:05:22 +01:00
test_smart_ptr.py Fix various minor memory leaks in the tests (found by Valgrind in #2746) (#2758) 2021-01-01 17:05:22 +01:00
test_stl.cpp style: clang-tidy: llvm-namespace-comment 2020-09-15 09:56:59 -04:00
test_stl.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_stl_binders.cpp Fix various minor memory leaks in the tests (found by Valgrind in #2746) (#2758) 2021-01-01 17:05:22 +01:00
test_stl_binders.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_tagbased_polymorphic.cpp style: clang-tidy: llvm-namespace-comment 2020-09-15 09:56:59 -04:00
test_tagbased_polymorphic.py style: use Black everywhere (#2594) 2020-10-16 16:38:13 -04:00
test_union.cpp Fix assertion failure for unions (#1685) (#1709) 2019-06-11 23:28:58 +02:00
test_union.py ci: GHA basic format & pre-commit (#2309) 2020-07-20 13:35:21 -04:00
test_virtual_functions.cpp refactor: module -> module_ with typedef (#2544) 2020-10-03 13:38:03 -04:00
test_virtual_functions.py Add a Valgrind build on debug Python 3.9 (#2746) 2021-01-15 21:07:31 +01:00
valgrind-numpy-scipy.supp Add a Valgrind build on debug Python 3.9 (#2746) 2021-01-15 21:07:31 +01:00
valgrind-python.supp Add a Valgrind build on debug Python 3.9 (#2746) 2021-01-15 21:07:31 +01:00