* 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 86817db488.
* fix: only undef _ for catch cpp creation.
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
* test: Strip whitespace when comparing numpy dtypes for 1.22 compat
Strip whitespace when comparing numpy dtype str() in order to preserve
test compatibility with both numpy 1.22 and older versions whose output
differ by whitespace.
Fixes#3680
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* docs: update changelog for 2.9.1
* Update changelog.rst
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update changelog.rst
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* fix: support conda-forge
* Update setup.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add tests demonstrating smart_holder issues with multiple inheritance
* Propagate C++ multiple inheritance markers to all children
- Makes py::multiple_inheritance only needed in base classes hidden from pybind11
* msys ci: un-pin setup-msys2 action version
* msys ci: explicitly set PYTHONHOME and PYTHONPATH for c++ and interface tests (to workaround https://github.com/msys2/setup-msys2/issues/167)
* Add support for nested C++11 exceptions
* Remove wrong include
* Fix if directive
* Fix missing skipif
* Simplify code and try to work around MSVC bug
* Clarify comment
* Further simplify code
* Remove the last extra throw statement
* Qualify auto
* Fix typo
* Add missing return for consistency
* Fix clang-tidy complaint
* Fix python2 stub
* Make clang-tidy happy
* Fix compile error
* Fix python2 function signature
* Extract C++20 utility and backport
* Cleanup code a bit more
* Improve test case
* Consolidate code and fix signature
* Fix typo
* A way to register additional test targets.
* Support specifying tests with extension.
* Ensure TEST_OVERRIDE is backwards compatible.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Ensure regex is non greedy.
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Replacing ICC C++14 with C++17
* ICPC: -diag-disable:conversion
Try to suppress the `-Werror-all` promotion in `#include <variant>`
* Trying `-DPYBIND11_WERROR=OFF`
* Trying `-Wno-conversion` (todo: make specific to C++17 if it works)
* Inserting -Wno-conversion only for C++17
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
* docs: update changelog
* Update changelog.rst
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Ensure ThreadPool is closed in setup_helpers
The ParallelCompile setup helper using a ThreadPool to enable its
parallelism. It does not properly close the pool when it is done with
it.
This can lead to a "Exception ignored in: <function Pool.__del__..."
message with traceback being printed at shutdown.
Use pool.terminate() instead of context manager for Python 2.7
compatibility
* Add note to remove code that supports Python 2
Co-authored-by: Bobby Impollonia <bobby@k13capital.com>
* fix: vs2022 compilation, issue #3477
* silence warning for python 2.7
* disable warning around mbstowcs call
* move disable warning code closer to call site
* turn on vs2022 ci test
* ci: don't run helpers on Windows 2022 & Python 3.5
* limit workaround for stdlib shipped with vs2022 or later
* fix for: limit workaround for stdlib shipped with vs2022 or later
* fix 2 for: limit workaround for stdlib shipped with vs2022 or later
* comment
* ci: add a Windows 2019 run
* ci: add Python 2.7 check too
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
* Expand string_view support to str, bytes, memoryview
1. Allows constructing a str or bytes implicitly from a string_view;
this is essentially a small shortcut allowing a caller to write
`py::bytes{sv}` rather than `py::bytes{sv.data(), sv.size()}`.
2. Allows implicit conversion *to* string_view from py::bytes -- this
saves a fair bit more as currently there is no simple way to get such
a view of the bytes without copying it (or resorting to Python API
calls).
(This is not done for `str` because when the str contains unicode we
have to allocate to a temporary and so there might not be some string
data we can properly view without owning.)
3. Allows `memoryview::from_memory` to accept a string_view. As with
the other from_memory calls, it's entirely your responsibility to
keep it alive.
This also required moving the string_view availability detection into
detail/common.h because this PR needs it in pytypes.h, which is higher
up the include chain than cast.h where it was being detected currently.
* Move string_view include to pytypes.h
* CI-testing a fix for the "ambiguous conversion" issue.
This change is known to fix the `tensorflow::tstring` issue reported under https://github.com/pybind/pybind11/pull/3521#issuecomment-985100965
TODO: Minimal reproducer for the `tensorflow::tstring` issue.
* Make clang-tidy happy (hopefully).
* Adding minimal reproducer for the `tensorflow::tstring` issue.
Error without the enable_if trick:
```
/usr/local/google/home/rwgk/forked/pybind11/tests/test_builtin_casters.cpp:169:16: error: ambiguous conversion for functional-style cast from 'TypeWithBothOperatorStringAndStringView' to 'py::bytes'
return py::bytes(TypeWithBothOperatorStringAndStringView());
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/google/home/rwgk/forked/pybind11/include/pybind11/detail/../pytypes.h:1174:5: note: candidate constructor
bytes(const std::string &s) : bytes(s.data(), s.size()) { }
^
/usr/local/google/home/rwgk/forked/pybind11/include/pybind11/detail/../pytypes.h:1191:5: note: candidate constructor
bytes(std::string_view s) : bytes(s.data(), s.size()) { }
^
```
* Adding missing NOLINTNEXTLINE
* Also apply ambiguous conversion workaround to str()
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>