1. 02 Jan, 2023 1 commit
  2. 28 Nov, 2022 1 commit
  3. 22 Oct, 2022 1 commit
  4. 10 Oct, 2022 1 commit
    • Ralf W. Grosse-Kunstleve's avatar
      Reproducer and fix for issue encountered in smart_holder update. (#4228) · da104a9e
      Ralf W. Grosse-Kunstleve authored
      * Reproducer for issue encountered in smart_holder update.
      
      * clang-tidy compatibility (untested).
      
      * Add `enable_if_t` to workaround.
      
      * Bug fix: Move `PYBIND11_USING_WORKAROUND_FOR_CUDA_11_4_THROUGH_8` determination to detail/common.h
      
      So that it actually is defined in pybind11.h
      
      * Try using the workaround (which is nicer than the original code) universally.
      
      * Reduce reproducer for CUDA 11.7 issue encountered in smart_holder update.
      
      This commit tested in isolation on top of current master + first version of reproducer (62311eb431849d135a5db84f6c75ec390f2ede7c).
      
      Succeeds with Debian Clang 14.0.6 C++17 (and probably all other compilers).
      
      Fails for CUDA 11.7:
      
      ```
      cd /build/tests && /usr/local/cuda/bin/nvcc -forward-unknown-to-host-compiler -Dpybind11_tests_EXPORTS -I/mounted_pybind11/include -isystem=/usr/include/python3.10 -g --generate-code=arch=compute_52,code=[compute_52,sm_52] -Xcompiler=-fPIC -Xcompiler=-fvisibility=hidden -Werror all-warnings -std=c++17 -MD -MT tests/CMakeFiles/pybind11_tests.dir/test_class.cpp.o -MF CMakeFiles/pybind11_tests.dir/test_class.cpp.o.d -x cu -c /mounted_pybind11/tests/test_class.cpp -o CMakeFiles/pybind11_tests.dir/test_class.cpp.o
      /mounted_pybind11/tests/test_class.cpp(53): error: more than one instance of overloaded function "pybind11::class_<type_, options...>::def [with type_=test_class::pr4220_tripped_over_this::Empty0, options=<>]" matches the argument list:
                  function template "pybind11::class_<test_class::pr4220_tripped_over_this::Empty0> &pybind11::class_<type_, options...>::def(const char *, Func &&, const Extra &...) [with type_=test_class::pr4220_tripped_over_this::Empty0, options=<>]"
      /mounted_pybind11/include/pybind11/pybind11.h(1557): here
                  function template "pybind11::class_<test_class::pr4220_tripped_over_this::Empty0> &pybind11::class_<type_, options...>::def(const T &, const Extra &...) [with type_=test_class::pr4220_tripped_over_this::Empty0, options=<>]"
      /mounted_pybind11/include/pybind11/pybind11.h(1586): here
                  argument types are: (const char [8], <unknown-type>)
                  object type is: pybind11::class_<test_class::pr4220_tripped_over_this::Empty0>
      
      1 error detected in the compilation of "/mounted_pybind11/tests/test_class.cpp".
      ```
      da104a9e
  5. 14 Feb, 2022 1 commit
    • Ralf W. Grosse-Kunstleve's avatar
      Dropping MSVC 2015 (#3722) · a97e9d8c
      Ralf W. Grosse-Kunstleve authored
      * Changing `_MSC_VER` guard to `< 1910` (dropping MSVC 2015).
      
      * Removing MSVC 2015 from ci.yml, and .appveyor.yml entirely.
      
      * Bringing back .appveyor.yml from master.
      
      * appveyor Visual Studio 2017
      
      * 1st manual pass, builds & tests with unix_clang, before pre-commit.
      
      * After clang-format (via pre-commit).
      
      * Manual pass looking for "2015", builds & tests with unix_clang, before pre-commit.
      
      * Backtracking for include/pybind11 changes in previous commit.
      
      git checkout d07865846c7d31dd61111e6df801864327b65070 include/pybind11/attr.h include/pybind11/detail/common.h include/pybind11/functional.h
      
      --------------------
      
      CI #4160 errors observed:
      
      https://github.com/pybind/pybind11/pull/3722/commits/2a26873727214c5f1e159cba98f5c625b908381a
      https://github.com/pybind/pybind11/runs/5168332130?check_suite_focus=true
      
      $ grep ' error C' *.txt | sed 's/2022-02-12[^ ]*//' | sed 's/^[0-9][0-9]*//' | sed 's/^.*\.txt: //' | sort | uniqD:\a\pybind11\pybind11\include\pybind11\cast.h(1364,1): error C2752: 'pybind11::detail::type_caster<Eigen::Ref<Eigen::Vector3f,0,pybind11::EigenDStride>,void>': more than one partial specialization matches the template argument list [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]
      
      d:\a\pybind11\pybind11\include\pybind11\detail/common.h(1023): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized [D:\a\pybind11\pybind11\build\tests\cross_module_gil_utils.vcxproj]
      d:\a\pybind11\pybind11\include\pybind11\detail/common.h(1023): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized [D:\a\pybind11\pybind11\build\tests\pybind11_cross_module_tests.vcxproj]
      d:\a\pybind11\pybind11\include\pybind11\detail/common.h(1023): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]
      d:\a\pybind11\pybind11\include\pybind11\detail/common.h(1023): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized [D:\a\pybind11\pybind11\build\tests\test_embed\external_module.vcxproj]
      D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]
      D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj]
      
      $ grep ': error C2737' *.txt | sed 's/^.*MSVC//' | sed 's/___.*//' | sort | uniq
      
      _2017
      
      $ grep ': error C2752' *.txt
      
      3______3.8_____MSVC_2019_____x86_-DCMAKE_CXX_STANDARD=17.txt:2022-02-12T16:12:45.9921122Z D:\a\pybind11\pybind11\include\pybind11\cast.h(1364,1): error C2752: 'pybind11::detail::type_caster<Eigen::Ref<Eigen::Vector3f,0,pybind11::EigenDStride>,void>': more than one partial specialization matches the template argument list [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]
      
      $ grep ': fatal error C1001:' *.txt
      
      10______pypy-3.8-v7.3.7_____windows-2022_____x64.txt:2022-02-12T16:12:56.3163683Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj]
      1______3.6_____MSVC_2019_____x86.txt:2022-02-12T16:12:47.6774625Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]
      16______3.6_____windows-latest_____x64_-DPYBIND11_FINDPYTHON=ON.txt:2022-02-12T16:12:27.0556151Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj]
      17______3.9_____windows-2019_____x64.txt:2022-02-12T16:12:30.3822566Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj]
      2______3.7_____MSVC_2019_____x86.txt:2022-02-12T16:12:38.7018911Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]
      6______3.6_____windows-2022_____x64.txt:2022-02-12T16:12:00.4513642Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj]
      7______3.9_____windows-2022_____x64.txt:2022-02-12T16:11:43.6306160Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj]
      8______3.10_____windows-2022_____x64.txt:2022-02-12T16:11:49.9589644Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj]
      9______pypy-3.7-v7.3.7_____windows-2022_____x64.txt:2022-02-12T16:11:53.7912112Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj]
      
      * common.h: is_template_base_of
      
      * Re-applying 4 changes from 2a26873727214c5f1e159cba98f5c625b908381a that work universally.
      
      * `overload_cast = {};` only for MSVC 2017 and Clang 5
      
      * Refining condition for using is_template_base_of workaround.
      
      * Undoing MSVC 2015 workaround in test_constants_and_functions.cpp
      
      * CentOS7: silence_unused_warnings
      
      * Tweaks in response to reviews.
      
      * Adding windows-2022 C++20
      
      * Trying another way of adding windows-2022 C++20
      a97e9d8c
  6. 10 Feb, 2022 2 commits
  7. 09 Feb, 2022 1 commit
  8. 08 Feb, 2022 1 commit
  9. 20 Sep, 2021 2 commits
  10. 09 Sep, 2021 1 commit
    • Ralf W. Grosse-Kunstleve's avatar
      CodeHealth: Enabling clang-tidy google-explicit-constructor (#3250) · 6abf2baa
      Ralf W. Grosse-Kunstleve authored
      * Adding google-explicit-constructor to .clang-tidy
      
      * clang-tidy explicit attr.h (all automatic)
      
      * clang-tidy explicit cast.h (all automatic)
      
      * clang-tidy detail/init.h (1 NOLINT)
      
      * clang-tidy detail/type_caster_base.h (2 NOLINT)
      
      * clang-tidy pybind11.h (7 NOLINT)
      
      * clang-tidy detail/common.h (3 NOLINT)
      
      * clang-tidy detail/descr.h (2 NOLINT)
      
      * clang-tidy pytypes.h (23 NOLINT, only 1 explicit)
      
      * clang-tidy eigen.h (7 NOLINT, 0 explicit)
      
      * Adding 2 explicit in functional.h
      
      * Adding 4 explicit in iostream.h
      
      * clang-tidy numpy.h (1 NOLINT, 1 explicit)
      
      * clang-tidy embed.h (0 NOLINT, 1 explicit)
      
      * clang-tidy tests/local_bindings.h (0 NOLINT, 4 explicit)
      
      * clang-tidy tests/pybind11_cross_module_tests.cpp (0 NOLINT, 1 explicit)
      
      * clang-tidy tests/pybind11_tests.h (0 NOLINT, 2 explicit)
      
      * clang-tidy tests/test_buffers.cpp (0 NOLINT, 2 explicit)
      
      * clang-tidy tests/test_builtin_casters.cpp (0 NOLINT, 4 explicit)
      
      * clang-tidy tests/test_class.cpp (0 NOLINT, 6 explicit)
      
      * clang-tidy tests/test_copy_move.cpp (0 NOLINT, 7 explicit)
      
      * clang-tidy tests/test_embed/external_module.cpp (0 NOLINT, 1 explicit)
      
      * clang-tidy tests/test_embed/test_interpreter.cpp (0 NOLINT, 1 explicit)
      
      * clang-tidy tests/object.h (0 NOLINT, 2 explicit)
      
      * clang-tidy batch of fully automatic fixes.
      
      * Workaround for MSVC 19.16.27045.0 C++17 Python 2 C++ syntax error.
      6abf2baa
  11. 06 Aug, 2021 1 commit
    • Aaron Gokaslan's avatar
      maint(clang-tidy): Bugprone enable checks (#3166) · 3893f37b
      Aaron Gokaslan authored
      * Enable bugprone checks
      
      * Reset delta and massage config
      
      * Start to apply bugprone fixes
      
      * try to fix minor bug
      
      * Fix later
      
      * Fix perfect forwarding bugprone
      
      * Remove nolint
      
      * undo constructor delete
      
      * Fix bugprone-perfect-forwarding again
      
      * Remove TODO
      
      * Add another nolint for bugprone-exception-escape in scoped interpreter
      
      * Fix remaining bugprone errors
      
      * Properly apply bugprone-macro-parantheses
      
      * Redo formatting and remove bugprone nolint
      
      * Add coment and revert more whitespace changes
      
      * Fix typo
      
      * Fix parsing bug
      
      * Add back comma
      
      * Fix clang-tidy issue
      
      * Apply remaining clang-tidy fixes
      3893f37b
  12. 12 Jul, 2021 1 commit
    • Ralf W. Grosse-Kunstleve's avatar
      NOLINT reduction (#3096) · 2d468697
      Ralf W. Grosse-Kunstleve authored
      * Copying from prework_no_rst branch (PR #3087): test_numpy_array.cpp, test_stl.cpp
      
      * Manual changes reducing NOLINTs.
      
      * clang-format-diff.py
      
      * Minor adjustment to avoid MSVC warning C4702: unreachable code
      2d468697
  13. 09 Jul, 2021 1 commit
  14. 22 Jun, 2021 1 commit
    • Aaron Gokaslan's avatar
      fix(clang-tidy): performance fixes applied in tests and CI (#3051) · dac74ebd
      Aaron Gokaslan authored
      * 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
      dac74ebd
  15. 01 Feb, 2021 1 commit
  16. 18 Jan, 2021 1 commit
    • Michael Kuron's avatar
      fix: Intel ICC C++17 compatibility (#2729) · 48534089
      Michael Kuron authored
      
      
      * 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: default avatarTobias 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: default avatarAxel Huebl <axel.huebl@plasma.ninja>
      Co-authored-by: default avatarHenry Schreiner <henryschreineriii@gmail.com>
      48534089
  17. 15 Jan, 2021 1 commit
    • Axel Huebl's avatar
      ci: Intel icc/icpc via oneAPI (#2573) · 0b3df7f9
      Axel Huebl authored
      
      
      * 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: default avatarHenry Schreiner <henryschreineriii@gmail.com>
      0b3df7f9
  18. 01 Jan, 2021 1 commit
    • Yannick Jadoul's avatar
      Fix various minor memory leaks in the tests (found by Valgrind in #2746) (#2758) · e57dd471
      Yannick Jadoul authored
      * Fix leak in the test_copy_move::test_move_fallback
      
      * Fix leaking PyMethodDef in test_class::test_implicit_conversion_life_support
      
      * Plumb leak in test_buffer, occuring when a mutable buffer is requested for a read-only object, and enable test_buffer.py
      
      * Fix weird return_value_policy::reference in test_stl_binders, and enable those tests
      
      * Cleanup nodelete holder objects in test_smart_ptr, and enable those tests
      e57dd471
  19. 08 Oct, 2020 1 commit
    • Yannick Jadoul's avatar
      Check scope's __dict__ instead of using hasattr when registering classes and exceptions (#2335) · 71aea49b
      Yannick Jadoul authored
      * Check scope's __dict__ instead of using hasattr when registering classes and exceptions, to allow registering the same name in a derived class scope
      
      * Extend test_base_and_derived_nested_scope test
      
      * Add tests on error being thrown registering duplicate classes
      
      * Circumvent bug with combination of test_class.py::test_register_duplicate_class and test_factory_constructors.py::test_init_factory_alias
      71aea49b
  20. 05 Oct, 2020 1 commit
    • Yannick Jadoul's avatar
      Fail on passing py::object with wrong Python type to py::object subclass using... · f537093a
      Yannick Jadoul authored
      Fail on passing py::object with wrong Python type to py::object subclass using PYBIND11_OBJECT macro (#2349)
      
      * Fail on passing py::object with wrong Python type to py::object subclass using PYBIND11_OBJECT macro
      
      * Split off test_non_converting_constructors from test_constructors
      
      * Fix test_as_type, as py::type constructor now throws an error itself if the argument is not a type
      
      * Replace tp_name access by pybind11::detail::get_fully_qualified_tp_name
      
      * Move forward-declaration of get_fully_qualified_tp_name to detail/common.h
      
      * Don't add the builtins module name in get_fully_qualified_tp_name for PyPy
      
      * Add PYBIND11_BUILTINS_MODULE macro, and use it in get_fully_qualified_tp_name
      f537093a
  21. 03 Oct, 2020 1 commit
  22. 02 Oct, 2020 1 commit
  23. 17 Sep, 2020 1 commit
  24. 15 Sep, 2020 3 commits
    • Henry Schreiner's avatar
      b491b465
    • Henry Schreiner's avatar
      style: clang-tidy: modernize-use-using · b342c373
      Henry Schreiner authored
      b342c373
    • Yannick Jadoul's avatar
      Resolve empty statement warning when using PYBIND11_OVERLOAD_PURE_NAME and... · d65e34d6
      Yannick Jadoul authored
      Resolve empty statement warning when using PYBIND11_OVERLOAD_PURE_NAME and PYBIND11_OVERLOAD_PURE (#2325)
      
      * Wrap PYBIND11_OVERLOAD_NAME and PYBIND11_OVERLOAD_PURE_NAME in do { ... } while (false), and resolve trailing semicolon
      
      * Deprecate PYBIND11_OVERLOAD_* and get_overload in favor of PYBIND11_OVERRIDE_* and get_override
      
      * Correct erroneous usage of 'overload' instead of 'override' in the implementation and internals
      
      * Fix tests to use non-deprecated PYBIND11_OVERRIDE_* macros
      
      * Update docs to use override instead of overload where appropriate, and add warning about deprecated aliases
      
      * Add semicolons to deprecated PYBIND11_OVERLOAD macros to match original behavior
      
      * Remove deprecation of PYBIND11_OVERLOAD_* macros and get_overload
      
      * Add note to changelog and upgrade guide
      d65e34d6
  25. 14 Sep, 2020 1 commit
    • Henry Schreiner's avatar
      feat: py::type::of<T>() and py::type::of(h) (#2364) · f12ec00d
      Henry Schreiner authored
      * feat: type<T>()
      
      * refactor: using py::type as class
      
      * refactor: py::object as base
      
      * wip: tigher api
      
      * refactor: fix conversion and limit API further
      
      * docs: some added notes from @EricCousineau-TRI
      
      * refactor: use py::type::of
      f12ec00d
  26. 01 Aug, 2020 1 commit
  27. 26 Jul, 2020 1 commit
  28. 26 Apr, 2020 1 commit
  29. 09 Nov, 2018 1 commit
    • Wenzel Jakob's avatar
      Support C++17 aligned new statement (#1582) · e2eca4f8
      Wenzel Jakob authored
      * Support C++17 aligned new statement
      
      This patch makes pybind11 aware of nonstandard alignment requirements in
      bound types and passes on this information to C++17 aligned 'new'
      operator. Pre-C++17, the behavior is unchanged.
      e2eca4f8
  30. 25 Sep, 2018 1 commit
    • oremanj's avatar
      Fix potential crash when calling an overloaded function (#1327) · e7761e33
      oremanj authored
      * Fix potential crash when calling an overloaded function
      
      The crash would occur if:
      - dispatcher() uses two-pass logic (because the target is overloaded and some arguments support conversions)
      - the first pass (with conversions disabled) doesn't find any matching overload
      - the second pass does find a matching overload, but its return value can't be converted to Python
      
      The code for formatting the error message assumed `it` still pointed to the selected overload,
      but during the second-pass loop `it` was nullptr. Fix by setting `it` correctly if a second-pass
      call returns a nullptr `handle`. Add a new test that segfaults without this fix.
      
      * Make overload iteration const-correct so we don't have to iterate again on second-pass error
      
      * Change test_error_after_conversions dependencies to local classes/variables
      e7761e33
  31. 12 Jan, 2018 1 commit
    • Jason Rhinelander's avatar
      Use stricter brace initialization · adbc8111
      Jason Rhinelander authored
      This updates the `py::init` constructors to only use brace
      initialization for aggregate initiailization if there is no constructor
      with the given arguments.
      
      This, in particular, fixes the regression in #1247 where the presence of
      a `std::initializer_list<T>` constructor started being invoked for
      constructor invocations in 2.2 even when there was a specific
      constructor of the desired type.
      
      The added test case demonstrates: without this change, it fails to
      compile because the `.def(py::init<std::vector<int>>())` constructor
      tries to invoke the `T(std::initializer_list<std::vector<int>>)`
      constructor rather than the `T(std::vector<int>)` constructor.
      
      By only using `new T{...}`-style construction when a `T(...)`
      constructor doesn't exist, we should bypass this by while still allowing
      `py::init<...>` to be used for aggregate type initialization (since such
      types, by definition, don't have a user-declared constructor).
      adbc8111
  32. 22 Nov, 2017 1 commit
    • Francesco Biscani's avatar
      Add -Wdeprecated to test suite and fix associated warnings (#1191) · ba33b2fc
      Francesco Biscani authored
      This commit turns on `-Wdeprecated` in the test suite and fixes several
      associated deprecation warnings that show up as a result:
      
      - in C++17 `static constexpr` members are implicitly inline; our
        redeclaration (needed for C++11/14) is deprecated in C++17.
      
      - various test suite classes have destructors and rely on implicit copy
        constructors, but implicit copy constructor definitions when a
        user-declared destructor is present was deprecated in C++11.
      
      - Eigen also has various implicit copy constructors, so just disable
        `-Wdeprecated` in `eigen.h`.
      ba33b2fc
  33. 07 Nov, 2017 1 commit
    • Jason Rhinelander's avatar
      __qualname__ and nested class naming fixes (#1171) · 71178922
      Jason Rhinelander authored
      A few fixes related to how we set `__qualname__` and how we show the
      type name in function signatures:
      
      - `__qualname__` isn't supposed to have the module name at the
      beginning, but we've been putting it there.  This removes it, while
      keeping the `Nested.Class` name chaining.
      
      - print `__module__.__qualname__` rather than `type->tp_name`; the
      latter doesn't work properly for nested classes, so we would get
      `module.B` rather than `module.A.B` for a class `B` with parent `A`.
      This also unifies the Python 3 and PyPy code.  Fixes #1166.
      
      - This now sets a `__qualname__` attribute on the type (as would happen
      in Python 3.3+) for Python <3.3, including PyPy.  While not particularly
      important to have in earlier Python versions, it's useful for us to be
      able to extracted the nested name, which is why `__qualname__` was
      invented in the first place.
      
      - Added tests for the above.
      71178922
  34. 28 Aug, 2017 1 commit
  35. 22 Aug, 2017 2 commits