Commit Graph

113 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve
898d5b301c Manually fixing merge conflict. 2021-06-22 12:19:40 -07:00
Aaron Gokaslan
dac74ebdf5
fix(clang-tidy): performance fixes applied in tests and CI (#3051)
* Initial fixes

* Whoops

* Finish clang-tidy manual fixes

* Add two missing fixes

* Revert

* Update clang-tidy

* Try to fix unreachable code error

* Move nolint comment

* Apply missing fix

* Don't override clang-tidy config

* Does this fix clang-tidy?

* Make all clang-tidy errors visible

* Add comments about NOLINTs and remove a few

* Fix typo
2021-06-22 12:11:54 -04:00
Ralf W. Grosse-Kunstleve
8d1e0b3903
[smart_holder] clang-tidy fixes (related to recent clang-tidy changes on master). (#3053)
* clang-tidy fixes (related to recent clang-tidy changes on master).

* More clang-tidy fixes.
2021-06-21 12:40:10 -07:00
Ralf W. Grosse-Kunstleve
7f41bea169 Tracking ci.yml changes from master. 2021-06-19 15:56:08 -07:00
Ralf W. Grosse-Kunstleve
fb7452ce39 Merge branch 'master' into smart_holder 2021-06-19 15:52:36 -07:00
dependabot[bot]
9b3b357706
chore(deps): bump ilammy/msvc-dev-cmd from 1.8.1 to 1.9.0 (#3027) 2021-06-19 18:39:54 -04:00
Ralf W. Grosse-Kunstleve
cc0402ef19 Tracking ci.yml changes from master. 2021-06-18 01:43:25 -07:00
Ralf W. Grosse-Kunstleve
516bdae115 Merge branch 'master' into smart_holder 2021-06-18 01:40:28 -07:00
Ralf W. Grosse-Kunstleve
19d99a87fe
Working around Centos 8 failure. (#3030)
* Experiment using -DCMAKE_BUILD_TYPE=Debug for Centos 8.

* Moving comment because the current placement seems to mess up the cmake command.

* Using `echo > VAR_XXX` and `$(cat VAR_XXX)` trick to emulate using variables (https://github.com/actions/starter-workflows/issues/68#issuecomment-524937002).
2021-06-18 01:35:36 -07:00
Ralf W. Grosse-Kunstleve
8f6ca71390 Disabling broken Centos 8 CI. 2021-06-08 12:16:57 -07:00
Ralf W. Grosse-Kunstleve
c47f6aaf43 Tracking ci.yml changes from master. 2021-05-27 11:31:54 -07:00
Ralf W. Grosse-Kunstleve
2cfc017e2d Merge branch 'master' into smart_holder 2021-05-27 11:30:03 -07:00
dependabot[bot]
14023c9cda
chore(deps): bump ilammy/msvc-dev-cmd from 1.8.0 to 1.8.1 (#3021) 2021-05-27 06:10:28 +00:00
Ralf W. Grosse-Kunstleve
1f99e8e63a Tracking ci.yml changes from master. 2021-05-21 13:44:41 -07:00
Ralf W. Grosse-Kunstleve
9be81c84fa Merge branch 'master' into smart_holder 2021-05-21 13:42:19 -07:00
dependabot[bot]
f61855b9d8
chore(deps): bump ilammy/msvc-dev-cmd from 1 to 1.8.0 (#3001) 2021-05-13 23:21:13 -04:00
dependabot[bot]
bc7cf6ef17
chore(deps): bump jwlawson/actions-setup-cmake from 1.8 to 1.9 (#3000) 2021-05-13 23:19:51 -04:00
Ralf W. Grosse-Kunstleve
2256f2a2e1 Updating ci_sh_def.yml, ci_sh_def.yml.patch after git merge master. Pushing directly for this mechanical update. 2021-04-22 06:33:17 -07:00
Ralf W. Grosse-Kunstleve
212a083dc0 Merge branch 'master' into smart_holder 2021-04-22 06:30:10 -07:00
Henry Schreiner
54430436fe
ci: install Boost for boost checks (#2968) 2021-04-22 00:03:07 -04:00
Ralf W. Grosse-Kunstleve
91e81b07d7 Re-enabling Python 3.10-dev jobs, made possible by PR #2967. Pushing directly because this just affects the CI config. 2021-04-21 12:42:06 -07:00
Ralf W. Grosse-Kunstleve
7d093a1906 Merge branch 'master' into smart_holder 2021-04-21 12:36:53 -07:00
dependabot[bot]
bca4b36ba7
chore(deps): bump pre-commit/action from v2.0.2 to v2.0.3 (#2964)
Bumps [pre-commit/action](https://github.com/pre-commit/action) from v2.0.2 to v2.0.3.
- [Release notes](https://github.com/pre-commit/action/releases)
- [Commits](https://github.com/pre-commit/action/compare/v2.0.2...9b88afc9cd57fd75b655d5c71bd38146d07135fe)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-21 15:00:00 -04:00
Ralf W. Grosse-Kunstleve
d7f98ac9a1
Adding CI-SH-DEF GitHub Actions workflow, based on PR #2930. (#2963)
* Adding ci_sh_def.yml, based on PR #2930.

* Adding exludes for .patch files.
2021-04-20 14:34:31 -07:00
Ralf W. Grosse-Kunstleve
99de498b26
Bug fix: adding back !is_alias<Class>(ptr) that were accidentally omitted. (#2958)
* Bug fix: adding back `!is_alias<Class>(ptr)` that were accidentally omitted.

* Introducing PYBIND11_SH_AVL, PYBIND11_SH_DEF macros. Applying PYBIND11_SH_DEF to test_factory_constructors.py to complete test coverage.

* Using PYBIND11_SH_DEF in test_methods_and_attributes.cpp, for more complete test coverage.

* Using PYBIND11_SH_DEF in test_multiple_inheritance.cpp, for more complete test coverage.

* Cleaning up test_classh_mock.cpp.

* Better explanations for PYBIND11_SH_AVL, PYBIND11_SH_DEF.

* Disabling 3.10-dev builds.
2021-04-19 10:54:37 -07:00
Ralf W. Grosse-Kunstleve
ab590c624b Disabling deadsnakes 3.10-dev CI (currently broken). 2021-04-14 15:00:56 -07:00
Ralf W. Grosse-Kunstleve
4aab10a2d3 Merge branch 'master' into smart_holder 2021-04-13 05:35:28 -07:00
Henry Schreiner
e0c1dadb75
chore: add myself to CODEOWNERS (#2940)
* chore: add myself to CODEOWNERS

This will ensure I get notified about pull requests where these files change.

* Update .github/CODEOWNERS
2021-04-10 11:12:56 -04:00
Ralf W. Grosse-Kunstleve
88a09988e7 Merge branch 'master' into smart_holder 2021-04-08 23:17:31 -07:00
dependabot[bot]
16c23fef31
chore(deps): bump pre-commit/action from v2.0.0 to v2.0.2 (#2935) 2021-04-05 22:53:59 -04:00
Ralf W. Grosse-Kunstleve
3f35af7441 Adding smart_holder branch to workflow_dispatch in all places where stable appears. 2021-03-18 11:29:22 -07:00
dependabot[bot]
59f8d7f1bf
chore(deps): bump jwlawson/actions-setup-cmake from v1.7 to v1.8 (#2865) 2021-02-17 18:48:37 +00:00
dependabot[bot]
c236239356
chore(deps): bump pypa/gh-action-pypi-publish from v1.4.1 to v1.4.2 (#2851)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from v1.4.1 to v1.4.2.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.4.1...27b31702a0e7fc50959f5ad993c78deac1bdfc29)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-09 17:00:16 -05:00
Kumar Aditya
948d09d6df
test: Test against Python 3.10 (#2848) 2021-02-08 15:35:30 -05:00
dependabot[bot]
42e7380705
chore(deps): bump jwlawson/actions-setup-cmake from v1.6 to v1.7 (#2818)
Bumps [jwlawson/actions-setup-cmake](https://github.com/jwlawson/actions-setup-cmake) from v1.6 to v1.7.
- [Release notes](https://github.com/jwlawson/actions-setup-cmake/releases)
- [Commits](https://github.com/jwlawson/actions-setup-cmake/compare/v1.6...821902fd0e0da89b13fd3161d358e96bf7550883)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-25 15:11:18 -05:00
Henry Schreiner
44105ca1f2 docs: mention that the changelog block in PR is special 2021-01-19 22:47:40 -05:00
Henry Schreiner
2db0264aca
style: add clang-format file (#2310)
* style: adding clang-format as manual hook

* docs: adding a Clang-Format section. (#2803)

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2021-01-19 19:10:26 -05:00
Henry Schreiner
87f5aff4a7
ci: update to setup-cmake v1.6 (#2805) 2021-01-19 18:24:46 -05:00
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
Axel Huebl
0b3df7f964
ci: Intel icc/icpc via oneAPI (#2573)
* 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

* style: clang tidy fix

* style: fix missing NOLINT

* ICC: Update Compiler Name

Changed upstream with the last oneAPI release.

* ICC CI: Downgrade pytest

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

* Use new test pinning requirements.txt

* tests: add notes about intel, cleanup

Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2021-01-15 15:59:47 -05:00
Yannick Jadoul
0f8d5f2eb6
Add a Valgrind build on debug Python 3.9 (#2746)
* Adding a valgrind build on debug Python 3.9

Co-authored-by: Boris Staletic <boris.staletic@gmail.com>

* Add Valgrind suppression files

- Introduce suppression file, populate it with a first suppression taken from CPython, and fix one leak in the tests
- Suppress leak in NumPy
- More clean tests!
- Tests with names a-e passing (except for test_buffer)
- Suppress multiprocessing errors
- Merge multiprocessing suppressions into other suppression files
- Numpy seems to be spelled with a big P
- Append single entry from valgrind-misc.supp to valgrind-python.supp, and make clear valgrind-python.supp is only CPython

Co-authored-by: Boris Staletic <boris.staletic@gmail.com>

* Enable test_virtual_functions with a workaround

* Add a memcheck cmake target

- Add a memcheck cmake target
- Reformat cmake
- Appease the formatting overlords - they are angry
- Format CMake valgrind target decently

* Update CI config to new action versions

* fix: separate memcheck from pytest

* ci: cleanup

* Merge Valgrind and other deadsnakes builds

Co-authored-by: Boris Staletic <boris.staletic@gmail.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2021-01-15 21:07:31 +01:00
Yannick Jadoul
f243450e89
ci: disable builds for 3.10.0a4, and enable a nightly 3.10-dev build (#2792)
* Disable builds for 3.10.0a4, and enable a nightly 3.10-dev build

* Fix job name

* Remove deadsnakes job for now

* Add deadsnakes jobs

* There's no deadsnakes 2.7

* Add 3.10 to versions to be discovered by legacy FindPython, and fix debug input to deadsnakes/action

* Try out branch with fix

* Update to deadsnakes/action@v2.1.1
2021-01-13 23:13:19 -05:00
Henry Schreiner
5abce7fce2
ci: use fixed action (#2791) 2021-01-13 20:32:11 +01:00
Yannick Jadoul
7b7ec664b7
ci: pin CMake to 3.19.2, fixes issues with 3.19.3 on Linux (aarch64) and macOS (universal) (#2790) 2021-01-13 11:16:35 -05:00
Eric Cousineau
635e3fc92f
CONTRIBUTING: Add suggestion about passing pytest flags (#2738) 2020-12-23 18:02:03 -05:00
Henry Schreiner
d5af536fa1
ci: update cmake action (#2734) 2020-12-21 20:58:40 -05:00
Ralf W. Grosse-Kunstleve
cecdfadc58
minor cleanup: fixing or silencing flake8 errors (#2731)
* minor cleanup: fixing or silencing flake8 errors

* ci: lock CMake to non-Universal version

* Update .github/workflows/ci.yml

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2020-12-18 19:41:43 -05:00
Henry Schreiner
499fcd5447
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
2020-12-15 21:07:41 -05:00
Henry Schreiner
de78bddd7f
docs: better badges (#2656) 2020-11-15 12:23:33 -05:00
Robert Haschke
b72cebeb22
style: clang-tidy: modernize-use-using (#2645)
* style: clang-tidy: modernize-use-using

* style: more clang-tidy checking

Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2020-11-09 10:10:19 -08:00