1. 09 Feb, 2022 1 commit
  2. 08 Feb, 2022 1 commit
  3. 06 Feb, 2022 1 commit
    • Michał Górny's avatar
      tests: update catch to 2.13.5 to fix glibc 2.34 failures (#3679) · 96b943be
      Michał Górny authored
      * Download catch for MinGw
      
      * Fix rest of MinGW
      
      * fix: update catch to 2.13.5 to fix glibc 2.34 failures
      
      Update the downloaded Catch version to 2.13.5, in order to fix build
      failure on glibc 2.34:
      
      ```
      In file included from /usr/include/signal.h:328,
                       from /tmp/pybind11/.nox/tests-3-9/tmp/tests/catch/catch.hpp:8030,
                       from /tmp/pybind11/tests/test_embed/catch.cpp:13:
      /tmp/pybind11/.nox/tests-3-9/tmp/tests/catch/catch.hpp:10818:58: error: call to non-‘constexpr’ function ‘long int sysconf(int)’
      10818 |     static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
            |                                                          ^~~~~~~~~~~
      In file included from /usr/include/python3.9/Python.h:36,
                       from /tmp/pybind11/include/pybind11/detail/common.h:215,
                       from /tmp/pybind11/include/pybind11/pytypes.h:12,
                       from /tmp/pybind11/include/pybind11/cast.h:13,
                       from /tmp/pybind11/include/pybind11/attr.h:13,
                       from /tmp/pybind11/include/pybind11/pybind11.h:13,
                       from /tmp/pybind11/include/pybind11/embed.h:12,
                       from /tmp/pybind11/tests/test_embed/catch.cpp:4:
      /usr/include/unistd.h:640:17: note: ‘long int sysconf(int)’ declared here
        640 | extern long int sysconf (int __name) __THROW;
            |                 ^~~~~~~
      In file included from /tmp/pybind11/tests/test_embed/catch.cpp:13:
      /tmp/pybind11/.nox/tests-3-9/tmp/tests/catch/catch.hpp:10877:45: error: size of array ‘altStackMem’ is not an integral constant-expression
      10877 |     char FatalConditionHandler::altStackMem[sigStackSize] = {};
            |                                             ^~~~~~~~~~~~
      ```
      
      The newest Catch version cannot be used yet because of regression:
      https://github.com/catchorg/Catch2/pull/2364
      
      
      
      * fix: add option for _ check, only define on pybind11
      
      * Revert "fix: add option for _ check, only define on pybind11"
      
      This reverts commit 86817db488c547816e21e20d678db318bb286384.
      
      * fix: only undef _ for catch cpp creation.
      Co-authored-by: default avatarAaron Gokaslan <skylion.aaron@gmail.com>
      Co-authored-by: default avatarHenry Schreiner <henryschreineriii@gmail.com>
      96b943be
  4. 15 Nov, 2021 1 commit
    • Trigve's avatar
      [master] Wrong caching of overrides (#3465) · afdc09de
      Trigve authored
      * override: Fix wrong caching of the overrides
      
      There was a problem when the python type, which was stored in override
      cache for C++ functions, was destroyed and  the record wasn't removed from the
      override cache. Therefor, dangling pointer was stored there. Then when the
      memory was reused and new type was allocated at the given address and the
      method with the same name (as previously stored in the cache) was actually
      overridden in python, it would wrongly find it in the override cache for C++
      functions and therefor override from python wouldn't be called.
      The fix is to erase the type from the override cache when the type is destroyed.
      
      * test: Pass by const ref instead of by value (clang-tidy)
      
      * test: Rename classes and move to different files
      
      Rename the classes and files so they're no too generic. Also, better place to
      test the stuff is in test_virtual_functions.cpp/.py as we're basically testing
      the virtual functions/trampolines.
      
      * Add TODO for erasure code
      
      * [pre-commit.ci] auto fixes from pre-commit.com hooks
      
      for more information, see https://pre-commit.ci
      
      Co-authored-by: default avatarpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
      afdc09de
  5. 04 Oct, 2021 1 commit
  6. 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
  7. 26 Aug, 2021 1 commit
    • Dan's avatar
      Call PySys_SetArgv when initializing interpreter. (#2341) · 930bb16c
      Dan authored
      
      
      * Call PySys_SetArgv when initializing interpreter.
      
      * Document argc/argv parameters in initialize_interpreter.
      
      * Remove manual memory management from set_interpreter_argv in favor of smart pointers.
      
      * Use size_t for indexers in set_interpreter_argv.
      
      * Minimize macros for flow control in set_interpreter_argv.
      
      * Fix 'unused variable' warning on Py2
      
      * whitespace
      
      * Define wide_char_arg_deleter outside set_interpreter_argv.
      
      * Do sys.path workaround in C++ rather than eval.
      
      * Factor out wchar conversion to a separate function.
      
      * Restore widened_argv variable declaration.
      
      * Fix undeclared widened_arg variable on some paths.
      
      * Use delete[] to match new wchar_t[].
      
      * Fix compiler errors
      
      * Use PY_VERSION_HEX for a cleaner CVE-2008-5983 mode check.
      
      * Fix typo
      
      * Use explicit type for deleter so delete[] works cross-compiler.
      
      * Always use PySys_SetArgvEx because pybind11 doesn't support pythons that don't include it.
      
      * Remove pointless ternary operator.
      
      * Use unique_ptr.reset instead of a second initialization.
      
      * Rename add_program_dir_to_path parameter to clarify intent.
      
      * Add defined() check before evaluating HAVE_BROKEN_MBSTOWCS.
      
      * Apply clang-tidy fixes
      
      * Pre-commit
      
      * refactor: use const for set_interpreter_argv
      
      * Try to fix const issue and allocate vector properly
      
      * fix: copy strings on Python 2
      
      * Applying clang-format-diff relative to master.
      
      The only manual change is an added empty line between pybind11 and system `#include`s.
      
      ```
      git diff -U0 --no-color master | python3 $HOME/clone/llvm-project/clang/tools/clang-format/clang-format-diff.py -p1 -style=file -i
      ```
      Co-authored-by: default avatarBoris Staletic <boris.staletic@gmail.com>
      Co-authored-by: default avatarAaron Gokaslan <skylion.aaron@gmail.com>
      Co-authored-by: default avatarHenry Schreiner <henryschreineriii@gmail.com>
      Co-authored-by: default avatarRalf W. Grosse-Kunstleve <rwgk@google.com>
      930bb16c
  8. 24 Aug, 2021 1 commit
  9. 29 Jul, 2021 2 commits
  10. 27 Jul, 2021 1 commit
  11. 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
  12. 19 Jan, 2021 1 commit
  13. 09 Nov, 2020 1 commit
  14. 03 Oct, 2020 1 commit
  15. 15 Sep, 2020 1 commit
    • 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
  16. 19 Aug, 2020 2 commits
    • Henry Schreiner's avatar
      tests: avoid putting build products into source directory (#2353) · 04fdc44f
      Henry Schreiner authored
      * tests: keep source dir clean
      
      * ci: make first build inplace
      
      * ci: drop dev setting (wasn't doing anything)
      
      * tests: warn if source directory is dirty
      04fdc44f
    • Henry Schreiner's avatar
      feat: new FindPython support (#2370) · 1729aae9
      Henry Schreiner authored
      * feat: FindPython support
      
      * refactor: rename to PYBIND11_FINDPYTHON
      
      * docs: Caps fixes
      
      * feat: NOPYTHON mode
      
      * test: check simple call
      
      * docs: add changelog/upgrade guide
      
      * feat: Support Python3 and Python2
      
      * refactor: Use targets in tests
      
      * fix: support CMake 3.4+
      
      * feat: classic search also finds virtual environments
      
      * docs: some updates from @wjakob's review
      
      * fix: wrong name for QUIET mode variable, reported by @skoslowski
      
      * refactor: cleaner output messaging
      
      * fix: support debug Python's in FindPython mode too
      
      * fixup! refactor: cleaner output messaging
      
      * fix: missing pybind11_FOUND and pybind11_INCLUDE_DIR restored to subdir mode
      
      * fix: nicer reporting of Python / PyPy
      
      * fix: out-of-order variable fix
      
      * docs: minor last-minute cleanup
      1729aae9
  17. 12 Aug, 2020 1 commit
  18. 31 Jul, 2020 2 commits
  19. 28 Jul, 2020 1 commit
  20. 26 Jul, 2020 2 commits
  21. 23 Jul, 2020 1 commit
  22. 20 Jul, 2020 1 commit
  23. 19 Jul, 2018 1 commit
    • Jason Rhinelander's avatar
      Fix compatibility with catch v2 · f7bc18f5
      Jason Rhinelander authored
      Catch v2 changed the `run(...)` signature to take a `char *argv[]`,
      arguing partly that technically a `char *argv[]` type is the correct
      `main()` signature rather than `const char *argv[]`.
      
      Dropping the `const` here doesn't appear to cause any problems with
      catch v1 (tested against both the cmake-downloaded 1.9.3 and Debian's
      1.12.1 package) so we can follow suit.
      f7bc18f5
  24. 11 Jan, 2018 1 commit
    • Jason Rhinelander's avatar
      Fix segfault when reloading interpreter with external modules (#1092) · 326deef2
      Jason Rhinelander authored
      * Fix segfault when reloading interpreter with external modules
      
      When embedding the interpreter and loading external modules in that
      embedded interpreter, the external module correctly shares its
      internals_ptr with the one in the embedded interpreter.  When the
      interpreter is shut down, however, only the `internals_ptr` local to
      the embedded code is actually reset to nullptr: the external module
      remains set.
      
      The result is that loading an external pybind11 module, letting the
      interpreter go through a finalize/initialize, then attempting to use
      something in the external module fails because this external module is
      still trying to use the old (destroyed) internals.  This causes
      undefined behaviour (typically a segfault).
      
      This commit fixes it by adding a level of indirection in the internals
      path, converting the local internals variable to `internals **` instead
      of `internals *`.  With this change, we can detect a stale internals
      pointer and reload the internals pointer (either from a capsule or by
      creating a new internals instance).
      
      (No issue number: this was reported on gitter by @henryiii and @aoloe).
      326deef2
  25. 23 Dec, 2017 1 commit
    • Jason Rhinelander's avatar
      Silence new MSVC C++17 deprecation warnings · 3be401f2
      Jason Rhinelander authored
      In the latest MSVC in C++17 mode including Eigen causes warnings:
      
          warning C4996: 'std::unary_negate<_Fn>': warning STL4008: std::not1(),
          std::not2(), std::unary_negate, and std::binary_negate are deprecated in
          C++17. They are superseded by std::not_fn(). You can define
          _SILENCE_CXX17_NEGATORS_DEPRECATION_WARNING or
          _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have
          received this warning.
      
      This disables 4996 for the Eigen includes.
      
      Catch generates a similar warning for std::uncaught_exception, so
      disable the warning there, too.
      
      In both cases this is temporary; we can (and should) remove the warnings
      disabling once new upstream versions of Eigen and Catch are available
      that address the warning. (The Catch one, in particular, looks to be
      fixed in upstream master, so will probably be fixed in the next (2.0.2)
      release).
      3be401f2
  26. 22 Oct, 2017 1 commit
    • Jason Rhinelander's avatar
      Miscellaneous travis-ci updates/fixes · 835fa9bc
      Jason Rhinelander authored
      - For the debian/buster docker build (GCC 7/C++17) install and use the
        system `catch` package; this also renames "COMPILER_PACKAGES" to
        "EXTRA_PACKAGES" since it now contains a non-compiler package.
      
      - Add a status message indicating the catch version being used for
        compiling the embedded tests
      
      - Simplify some bash code by using VAR+=" foo" to append (rather than
        VAR="${VAR} foo"
      
      - Fix CMAKE_INCLUDE_PATH appending: it was prepending the ':' but not
        the existing $CMAKE_INCLUDE_PATH value and so would end up with
        ":/eigen-path" if CMAKE_INCLUDE_PATH was already set.  (This wasn't
        bug that was actually noticed since currently nothing else sets it).
      835fa9bc
  27. 12 Sep, 2017 1 commit
  28. 24 Jun, 2017 2 commits
  29. 08 Jun, 2017 1 commit
    • Jason Rhinelander's avatar
      Destroy internals if created during Py_Finalize() · 4edb1ce2
      Jason Rhinelander authored
      Py_Finalize could potentially invoke code that calls `get_internals()`,
      which could create a new internals object if one didn't exist.
      `finalize_interpreter()` didn't catch this because it only used the
      pre-finalize interpreter pointer status; if this happens, it results in
      the internals pointer not being properly destroyed with the interpreter,
      which leaks, and also causes a `get_internals()` under a future
      interpreter to return an internals object that is wrong in various ways.
      4edb1ce2
  30. 07 Jun, 2017 1 commit
  31. 28 May, 2017 3 commits