mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00:00
Manual pass looking for "2015", builds & tests with unix_clang, before pre-commit.
This commit is contained in:
parent
d07865846c
commit
2a26873727
@ -122,7 +122,7 @@ Supported compilers
|
|||||||
1. Clang/LLVM 3.3 or newer (for Apple Xcode's clang, this is 5.0.0 or
|
1. Clang/LLVM 3.3 or newer (for Apple Xcode's clang, this is 5.0.0 or
|
||||||
newer)
|
newer)
|
||||||
2. GCC 4.8 or newer
|
2. GCC 4.8 or newer
|
||||||
3. Microsoft Visual Studio 2015 Update 3 or newer
|
3. Microsoft Visual Studio 2017 or newer
|
||||||
4. Intel classic C++ compiler 18 or newer (ICC 20.2 tested in CI)
|
4. Intel classic C++ compiler 18 or newer (ICC 20.2 tested in CI)
|
||||||
5. Cygwin/GCC (previously tested on 2.5.1)
|
5. Cygwin/GCC (previously tested on 2.5.1)
|
||||||
6. NVCC (CUDA 11.0 tested in CI)
|
6. NVCC (CUDA 11.0 tested in CI)
|
||||||
|
@ -87,8 +87,6 @@ included to tell pybind11 how to visit the variant.
|
|||||||
|
|
||||||
pybind11 only supports the modern implementation of ``boost::variant``
|
pybind11 only supports the modern implementation of ``boost::variant``
|
||||||
which makes use of variadic templates. This requires Boost 1.56 or newer.
|
which makes use of variadic templates. This requires Boost 1.56 or newer.
|
||||||
Additionally, on Windows, MSVC 2017 is required because ``boost::variant``
|
|
||||||
falls back to the old non-variadic implementation on MSVC 2015.
|
|
||||||
|
|
||||||
.. _opaque:
|
.. _opaque:
|
||||||
|
|
||||||
|
@ -1118,13 +1118,6 @@ described trampoline:
|
|||||||
py::class_<A, Trampoline>(m, "A") // <-- `Trampoline` here
|
py::class_<A, Trampoline>(m, "A") // <-- `Trampoline` here
|
||||||
.def("foo", &Publicist::foo); // <-- `Publicist` here, not `Trampoline`!
|
.def("foo", &Publicist::foo); // <-- `Publicist` here, not `Trampoline`!
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
MSVC 2015 has a compiler bug (fixed in version 2017) which
|
|
||||||
requires a more explicit function binding in the form of
|
|
||||||
``.def("foo", static_cast<int (A::*)() const>(&Publicist::foo));``
|
|
||||||
where ``int (A::*)() const`` is the type of ``A::foo``.
|
|
||||||
|
|
||||||
Binding final classes
|
Binding final classes
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
|
@ -32,8 +32,7 @@ The last line will both compile and run the tests.
|
|||||||
Windows
|
Windows
|
||||||
-------
|
-------
|
||||||
|
|
||||||
On Windows, only **Visual Studio 2015** and newer are supported since pybind11 relies
|
On Windows, only **Visual Studio 2017** and newer are supported.
|
||||||
on various C++11 language features that break older versions of Visual Studio.
|
|
||||||
|
|
||||||
.. Note::
|
.. Note::
|
||||||
|
|
||||||
|
@ -434,8 +434,7 @@ you can use ``py::detail::overload_cast_impl`` with an additional set of parenth
|
|||||||
.def("set", overload_cast_<int>()(&Pet::set), "Set the pet's age")
|
.def("set", overload_cast_<int>()(&Pet::set), "Set the pet's age")
|
||||||
.def("set", overload_cast_<const std::string &>()(&Pet::set), "Set the pet's name");
|
.def("set", overload_cast_<const std::string &>()(&Pet::set), "Set the pet's name");
|
||||||
|
|
||||||
.. [#cpp14] A compiler which supports the ``-std=c++14`` flag
|
.. [#cpp14] A compiler which supports the ``-std=c++14`` flag.
|
||||||
or Visual Studio 2015 Update 2 and newer.
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
14
docs/faq.rst
14
docs/faq.rst
@ -220,20 +220,6 @@ In addition to decreasing binary size, ``-fvisibility=hidden`` also avoids
|
|||||||
potential serious issues when loading multiple modules and is required for
|
potential serious issues when loading multiple modules and is required for
|
||||||
proper pybind operation. See the previous FAQ entry for more details.
|
proper pybind operation. See the previous FAQ entry for more details.
|
||||||
|
|
||||||
Working with ancient Visual Studio 2008 builds on Windows
|
|
||||||
=========================================================
|
|
||||||
|
|
||||||
The official Windows distributions of Python are compiled using truly
|
|
||||||
ancient versions of Visual Studio that lack good C++11 support. Some users
|
|
||||||
implicitly assume that it would be impossible to load a plugin built with
|
|
||||||
Visual Studio 2015 into a Python distribution that was compiled using Visual
|
|
||||||
Studio 2008. However, no such issue exists: it's perfectly legitimate to
|
|
||||||
interface DLLs that are built with different compilers and/or C libraries.
|
|
||||||
Common gotchas to watch out for involve not ``free()``-ing memory region
|
|
||||||
that that were ``malloc()``-ed in another shared library, using data
|
|
||||||
structures with incompatible ABIs, and so on. pybind11 is very careful not
|
|
||||||
to make these types of mistakes.
|
|
||||||
|
|
||||||
How can I properly handle Ctrl-C in long-running functions?
|
How can I properly handle Ctrl-C in long-running functions?
|
||||||
===========================================================
|
===========================================================
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ error is raised if the compiler does not meet the requirements:
|
|||||||
|
|
||||||
* GCC >= 4.8
|
* GCC >= 4.8
|
||||||
* clang >= 3.3 (appleclang >= 5.0)
|
* clang >= 3.3 (appleclang >= 5.0)
|
||||||
* MSVC >= 2015u3
|
* MSVC >= 2017
|
||||||
* Intel C++ >= 15.0
|
* Intel C++ >= 15.0
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ struct base {
|
|||||||
|
|
||||||
PYBIND11_DEPRECATED(
|
PYBIND11_DEPRECATED(
|
||||||
"base<T>() was deprecated in favor of specifying 'T' as a template argument to class_")
|
"base<T>() was deprecated in favor of specifying 'T' as a template argument to class_")
|
||||||
base() {} // NOLINT(modernize-use-equals-default): breaks MSVC 2015 when adding an attribute
|
base() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Keep patient alive while nurse lives
|
/// Keep patient alive while nurse lives
|
||||||
@ -82,8 +82,7 @@ struct metaclass {
|
|||||||
handle value;
|
handle value;
|
||||||
|
|
||||||
PYBIND11_DEPRECATED("py::metaclass() is no longer required. It's turned on by default now.")
|
PYBIND11_DEPRECATED("py::metaclass() is no longer required. It's turned on by default now.")
|
||||||
// NOLINTNEXTLINE(modernize-use-equals-default): breaks MSVC 2015 when adding an attribute
|
metaclass() = default;
|
||||||
metaclass() {}
|
|
||||||
|
|
||||||
/// Override pybind11's default metaclass
|
/// Override pybind11's default metaclass
|
||||||
explicit metaclass(handle value) : value(value) {}
|
explicit metaclass(handle value) : value(value) {}
|
||||||
|
@ -822,14 +822,8 @@ struct is_template_base_of_impl {
|
|||||||
/// Check if a template is the base of a type. For example:
|
/// Check if a template is the base of a type. For example:
|
||||||
/// `is_template_base_of<Base, T>` is true if `struct T : Base<U> {}` where U can be anything
|
/// `is_template_base_of<Base, T>` is true if `struct T : Base<U> {}` where U can be anything
|
||||||
template <template <typename...> class Base, typename T>
|
template <template <typename...> class Base, typename T>
|
||||||
#if !defined(_MSC_VER)
|
|
||||||
using is_template_base_of
|
using is_template_base_of
|
||||||
= decltype(is_template_base_of_impl<Base>::check((intrinsic_t<T> *) nullptr));
|
= decltype(is_template_base_of_impl<Base>::check((intrinsic_t<T> *) nullptr));
|
||||||
#else // MSVC2015 has trouble with decltype in template aliases
|
|
||||||
struct is_template_base_of
|
|
||||||
: decltype(is_template_base_of_impl<Base>::check((intrinsic_t<T> *) nullptr)) {
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Check if T is an instantiation of the template `Class`. For example:
|
/// Check if T is an instantiation of the template `Class`. For example:
|
||||||
/// `is_instantiation<shared_ptr, T>` is true if `T == shared_ptr<U>` where U can be anything.
|
/// `is_instantiation<shared_ptr, T>` is true if `T == shared_ptr<U>` where U can be anything.
|
||||||
@ -1000,9 +994,6 @@ struct nodelete {
|
|||||||
PYBIND11_NAMESPACE_BEGIN(detail)
|
PYBIND11_NAMESPACE_BEGIN(detail)
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
struct overload_cast_impl {
|
struct overload_cast_impl {
|
||||||
// NOLINTNEXTLINE(modernize-use-equals-default): MSVC 2015 needs this
|
|
||||||
constexpr overload_cast_impl() {}
|
|
||||||
|
|
||||||
template <typename Return>
|
template <typename Return>
|
||||||
constexpr auto operator()(Return (*pf)(Args...)) const noexcept -> decltype(pf) {
|
constexpr auto operator()(Return (*pf)(Args...)) const noexcept -> decltype(pf) {
|
||||||
return pf;
|
return pf;
|
||||||
@ -1029,8 +1020,7 @@ PYBIND11_NAMESPACE_END(detail)
|
|||||||
/// - regular: static_cast<Return (Class::*)(Arg0, Arg1, Arg2)>(&Class::func)
|
/// - regular: static_cast<Return (Class::*)(Arg0, Arg1, Arg2)>(&Class::func)
|
||||||
/// - sweet: overload_cast<Arg0, Arg1, Arg2>(&Class::func)
|
/// - sweet: overload_cast<Arg0, Arg1, Arg2>(&Class::func)
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
static constexpr detail::overload_cast_impl<Args...> overload_cast = {};
|
static constexpr detail::overload_cast_impl<Args...> overload_cast;
|
||||||
// MSVC 2015 only accepts this particular initialization syntax for this variable template.
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Const member function selector for overload_cast
|
/// Const member function selector for overload_cast
|
||||||
|
@ -99,8 +99,7 @@ public:
|
|||||||
Return operator()(Args... args) const {
|
Return operator()(Args... args) const {
|
||||||
gil_scoped_acquire acq;
|
gil_scoped_acquire acq;
|
||||||
object retval(hfunc.f(std::forward<Args>(args)...));
|
object retval(hfunc.f(std::forward<Args>(args)...));
|
||||||
/* Visual studio 2015 parser issue: need parentheses around this expression */
|
return retval.template cast<Return>();
|
||||||
return (retval.template cast<Return>());
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ TEST_SUBMODULE(constants_and_functions, m) {
|
|||||||
uint64_t zeros[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
|
uint64_t zeros[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
|
||||||
};
|
};
|
||||||
m.def("register_large_capture_with_invalid_arguments", [](py::module_ m) {
|
m.def("register_large_capture_with_invalid_arguments", [](py::module_ m) {
|
||||||
LargeCapture capture; // VS 2015's MSVC is acting up if we create the array here
|
LargeCapture capture; // VS 2015's MSVC was acting up when creating the array here
|
||||||
m.def(
|
m.def(
|
||||||
"should_raise",
|
"should_raise",
|
||||||
[capture](int) { return capture.zeros[9] + 33; },
|
[capture](int) { return capture.zeros[9] + 33; },
|
||||||
|
@ -154,8 +154,7 @@ class NCVirtTrampoline : public NCVirt {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Base {
|
struct Base {
|
||||||
/* for some reason MSVC2015 can't compile this if the function is pure virtual */
|
virtual std::string dispatch() const = 0;
|
||||||
virtual std::string dispatch() const { return {}; };
|
|
||||||
virtual ~Base() = default;
|
virtual ~Base() = default;
|
||||||
Base() = default;
|
Base() = default;
|
||||||
Base(const Base &) = delete;
|
Base(const Base &) = delete;
|
||||||
|
Loading…
Reference in New Issue
Block a user