Commit Graph

1888 Commits

Author SHA1 Message Date
Francesco Biscani
bd24155b8b Aligned allocation fix for clang-cl (#1988) 2019-11-16 01:18:24 +01:00
Francesco Biscani
deb3cb238a Add exception translation for std::overflow_error. (#1977) 2019-11-14 08:56:58 +01:00
Yannick Jadoul
55ff464233 Fixing SystemError when nb_bool/nb_nonzero sets a Python exception in type_caster<bool>::load (#1976) 2019-11-14 08:56:22 +01:00
Erick Matsen
b32b762c60 Fixing minor typo in basics.rst (#1984) 2019-11-14 08:54:46 +01:00
Matthew Dawkins
6f11347a30 Prevent cmake error when prefix empty (#1986) 2019-11-14 08:53:06 +01:00
Axel Huebl
a6355b00f8 CMake: Add Python 3.8 to pybind11Tools (#1974)
Add Python 3.8 to considered versions in CMake for additional
hints.
https://cmake.org/cmake/help/v3.2/module/FindPythonLibs.html
2019-10-31 12:40:15 +01:00
Sebastian Gsänger
a83d69e78f test pair-copyability on C++17 upwards (#1886)
* test pair-copyability on C++17 upwards

The stdlib falsely detects containers like M=std::map<T, U>
as copyable, even when one of T and U is not copyable.
Therefore we cannot rely on the stdlib dismissing std::pair<T, M>
by itself, even on C++17.

* fix is_copy_assignable

bind_map used std::is_copy_assignable which suffers from the same problems
as std::is_copy_constructible, therefore the same fix has been applied.

* created tests for copyability
2019-10-31 12:38:24 +01:00
Hans Dembinski
bdf6a5e870 Report type names in return value policy-related cast exceptions (#1965) 2019-10-23 13:19:58 +02:00
Hans Dembinski
c27a6e1378 make builds with python tests and cpp tests fail if either one fails (#1967) 2019-10-22 17:19:15 +02:00
Jeremy Nimmer
759221f5c5 Obey __cpp_sized_deallocation and __cpp_aligned_new
Don't assume that just because the language version is C++17 that the
standard library offers all C++17 features, too.  When using clang-6.0
and --std=c++17 on Ubuntu 18.04 with libstdc++, __cpp_sized_deallocation
is false.
2019-10-22 11:02:11 +02:00
Riccardo Bertossa
6c29cbf88d misleading comment corrected (strides in buffer_info is bytes and not number of entries) (#1958) 2019-10-18 17:55:17 +02:00
nicolov
de5a29c0d4 Fix build with -Wmissing-prototypes (#1954)
When building with `-Werror,-Wmissing-prototypes`, `clang` complains about missing prototypes for functions defined through macro expansions. This PR adds the missing prototypes.

```
error: no previous prototype for function 'pybind11_init_impl_embedded' [
-Werror,-Wmissing-prototypes]                                           
PYBIND11_EMBEDDED_MODULE(embedded, mod) {                                             
^                                                                           
external/pybind11/include/pybind11/embed.h:61:5: note: expanded from macro 'PYBIND11_EMBEDDED_MODULE'
    PYBIND11_EMBEDDED_MODULE_IMPL(name)                                       \
    ^                                                                         
external/pybind11/include/pybind11/embed.h:26:23: note: expanded from macro 'PYBIND11_EMBEDDED_MODULE_IMPL'
      extern "C" void pybind11_init_impl_##name() {      \                  
                      ^                                             
<scratch space>:380:1: note: expanded from here                     
pybind11_init_impl_embedded                                                                                                                      
^                                                                                                                                                
1 error generated.
```
2019-10-17 10:43:33 +02:00
Wenzel Jakob
dfde1554ea begin working on next version 2019-10-15 01:58:43 +02:00
Wenzel Jakob
80d452484c v2.4.3 release 2019-10-15 01:57:24 +02:00
Sergei Izmailov
6cb584e9de Adapt to python3.8 C API change (#1950)
* Adapt to python3.8 C API change

Do `Py_DECREF(type)` on all python objects on deallocation

fix #1946

* Add bare python3.8 build to CI matrix

While numpy/scipy wheels are available, run python3.8 test without them
2019-10-08 18:25:09 +02:00
Boris Dalstein
96be2c154f Fix version mismatch typos in .travis.yml (#1948) 2019-10-06 23:23:10 +02:00
Wenzel Jakob
34c2281e31 begin working on next version 2019-09-21 20:23:01 +02:00
Wenzel Jakob
2abd7e1eb4 updated release.rst to remove parts that are now automated 2019-09-21 20:22:33 +02:00
Wenzel Jakob
7ec2ddfc95 v2.4.2 release 2019-09-21 20:20:26 +02:00
Wenzel Jakob
7f5dad7d5f Remove usage of C++14 constructs (fixes #1929) 2019-09-21 19:03:14 +02:00
Wenzel Jakob
f3109d8419 future-proof Python version check from commit 31680e6 (@lgritz) 2019-09-21 18:09:35 +02:00
Wenzel Jakob
82cf793588 begin working on next version 2019-09-20 11:12:22 +02:00
Wenzel Jakob
e44fcc3c15 v2.4.1 release 2019-09-20 11:10:49 +02:00
Wenzel Jakob
31680e6f9c Implicit conversion from enum to int for Python 3.8 (fix by @sizmailov) 2019-09-20 11:06:10 +02:00
Wenzel Jakob
5fd187ebe9 minor changelog cleanup
[ci skip]
2019-09-20 10:49:54 +02:00
Wenzel Jakob
21d0eb460f Fix Python 3.8 test regression 2019-09-20 09:38:30 +02:00
Wenzel Jakob
e825205ac6 begin working on v2.4.1 2019-09-19 23:18:04 +02:00
Wenzel Jakob
00a0aa9929 v2.4.0 release 2019-09-19 23:06:22 +02:00
Samuel Debionne
6ca312b3bc Avoid infinite recursion in is_copy_constructible (#1910) 2019-09-19 21:24:05 +02:00
Wenzel Jakob
c9f5a464bc pybind11 internals: separate different compilers 2019-09-19 21:12:14 +02:00
Sergei Izmailov
09f0829401 Avoid conversion to int_ rhs argument of enum eq/ne (#1912)
* fix: Avoid conversion to `int_` rhs argument of enum eq/ne

* test: compare unscoped enum with strings

* suppress comparison to None warning

* test unscoped enum arithmetic and comparision with unsupported type
2019-09-19 18:23:27 +02:00
Lori A. Burns
f6c4c1047a restores __invert__ to arithmetic-enabled enum, fixes #1907 (#1909) 2019-09-04 22:16:21 +02:00
Stephen Larew
5b4751af26 Add const to buffer:request() (#1890) 2019-08-27 17:05:47 +02:00
Dmitry
8f5a8ab4ac Don't strip debug symbols in RelWithDebInfo mode (#1892) 2019-08-23 16:18:05 +02:00
kingofpayne
12e8774bc9 Added support for list insertion. (#1888) 2019-08-19 23:00:36 +02:00
Andre Schmeißer
19189b4c2c Make overload_cast_impl available in C++11 mode. (#1581)
* Make `overload_cast_impl` available in C++11 mode.

Narrow the scope of the `#if defined(PYBIND11_CPP14)` block around overload_cast to only
cover the parts where C++14 is stricly required. Thus, the implementation in
`pybind11::details::overload_cast_impl` is still available in C++11 mode.

* PR #1581: Modify test to use overload_cast_impl, update docs and change log
2019-08-19 12:54:33 +02:00
Vladimír Vondruš
04c8f4b56e Expose BufferError among other pybind11 exceptions. (#1852) 2019-08-19 12:48:03 +02:00
Samuel Debionne
87fa6a4342 Detect whether we are running in a Conda environment and adjust get_include() (#1877) 2019-08-19 12:43:33 +02:00
Sergei Lebedev
046267c629 Added .empty() to all collection types (#1887) 2019-08-16 23:43:08 +02:00
Sergei Lebedev
08b0bda4bc Added set::contains and generalized dict::contains (#1884)
Dynamically resolving __contains__ on each call is wasteful since set
has a public PySet_Contains function.
2019-08-16 21:32:27 +02:00
Vladimír Vondruš
5b0ea77c62 Fix -Wmissing-prototypes warning on Clang. (#1863)
The -Wmissing-prototypes Clang warning (or -Wmissing-declarations on
GCC) is very useful to avoid accidents where a function definition in a
source file doesn't match the corresponding declaration in a header
file, as it would warn already during compilation and not much later
during link time.

Unfortunately this means that exported functions defined only in the
source file (usually the ones annotated with `extern "C"`) will cause
this warning to be emitted too (on Clang, GCC has a slightly different
behavior with -Wmissing-declarations and doesn't warn here). This fixes
the warning by providing a declaration right before the definition.
2019-08-16 08:52:13 +02:00
ali-beep
5ef13eb680 Add negative indexing support to stl_bind. (#1882) 2019-08-15 19:41:11 +02:00
Borja Zarco
b2fdfd1228 Avoid use of lambda to work around a clang bug. (#1883)
Clang has a bug [1] in x86 Windows that is exposed by the use of lambdas with "unforwardable" prototypes. The error is "error: cannot compile this forwarded non-trivially copyable parameter yet", and the message was introduced in [2] (used to be an assertion).

[1] https://llvm.org/bugs/show_bug.cgi?id=28299
[2] feb1567e07
2019-08-15 13:42:43 +02:00
Saran Tunyasuvunakool
bdf1a2cc34 In internals.h, only look at _DEBUG when compiling with MSVC. (#1855)
* In internals.h, only look at _DEBUG when compiling with MSVC.

(_DEBUG is a MSVC-specific macro.)
2019-08-13 22:00:47 +02:00
Christoph Kahl
640b8fe6d9 fix #1406 add mingw compatibility (#1851) 2019-08-13 21:41:53 +02:00
Pauli Virtanen
c9d32a81f4 numpy: fix refcount leak to dtype singleton (#1860)
PyArray_DescrFromType returns a new reference, not borrowed one
2019-07-27 11:35:32 +02:00
Eric Cousineau
4a3464fd88 numpy: Provide concrete size aliases
Test for dtype checks now succeed without warnings
2019-07-23 13:17:20 +02:00
Eric Cousineau
e9ca89f453 numpy: Add test for explicit dtype checks. At present, int64 + uint64 do not exactly match dtype(...).num 2019-07-23 13:17:20 +02:00
phil-zxx
c6b699d9c2 Added ability to convert from datetime.date to system_clock::time_point (#1848)
* Added ability to convert from Python datetime.date and datetime.time to C++ system_clock::time_point
2019-07-19 11:28:48 +02:00
Jeremy Maitin-Shepard
a3f4a0e8ab Add support for __await__, __aiter__, and __anext__ protocols (#1842) 2019-07-18 09:02:35 +02:00