- 24 Jun, 2017 7 commits
-
-
Dean Moldovan committed
-
This fixes #856. Instead of the weakref trick, the internals structure holds an unordered_map from PyObject* to a vector of references. To avoid the cost of the unordered_map lookup for objects that don't have any keep_alive patients, a flag is added to each instance to indicate whether there is anything to do.
Bruce Merry committed -
Using `std::type_info::operator==` fails under libc++ because the .so is loaded with RTLD_LOCAL. libc++ considers types under such .sos distinct, and so comparing typeid() values directly isn't going to work. This adds a custom hasher and equality class for the type lookup maps when not under stdlibc++, and adds a `detail::same_type` function to perform the equality test. It also converts a few pointer arguments to const lvalue references, particularly since doing the pointer comparison wasn't technically valid to being with (though in practice, appeared to work everywhere). This fixes #912.
Jason Rhinelander committed -
Fixes a race condition when multiple threads try to acquire the GIL before `detail::internals` have been initialized. `gil_scoped_release` is now tasked with initializing `internals` (guaranteed single-threaded) to ensure the safety of subsequent `acquire` calls from multiple threads.
Dean Moldovan committed -
Jason Rhinelander committed
-
Jason Rhinelander committed
-
Wrapped long lines and removed a few trailing spaces.
Jason Rhinelander committed
-
- 23 Jun, 2017 2 commits
-
-
Fixes the issue as described in the comments of commit e27ea47c. This just adds `enable_if_t<std::is_move_constructible<T>::value>` to `make_move_constructor`. The change fixes MSVC and is harmless with other compilers.
Dean Moldovan committed -
CLion slows to a crawl when evaluating the intricate `PYBIND11_NUMPY_DTYPE` macro. This commit replaces the macro cascade with a simple `(void)0` to ease IDE evaluation.
Dean Moldovan committed
-
- 20 Jun, 2017 1 commit
-
-
Debian stretch was just released, so `debian:testing` and `debian:stetch` are starting to diverge; this commit keeps the travis-ci docker image on stretch for gcc6 and clang3.9. Debian has also moved gcc 7 from experimental to unstable, so this switches the gcc7 build to `sid`. Once it migrates to `testing` I'll switch the gcc 7 build docker image to `testing` and take it out of failure-allowed.
Jason Rhinelander committed
-
- 15 Jun, 2017 2 commits
-
-
This allows named capsules to be constructed with `py::capsule`.
Philip Austin committed -
Ian Bell committed
-
- 14 Jun, 2017 2 commits
-
-
./tools/check-style.sh fails on stock OS X currently; this fixes it: - use pipes directly rather than exec redirection (macOS's ancient version of bash fails with the latter) - macOS's ancient bash doesn't support '\e' escapes in `echo -e`; replace with \033 instead - BSD grep doesn't support GREP_COLORS, but does allow GREP_COLOR. Adding both doesn't hurt GNU grep: GREP_COLOR is deprecated, and won't be used when GREP_COLORS is set. - BSD grep doesn't collapse multiple /'s in the listed filename, so failures under `include/` would should up as `include//pybind11/whatever.h`. This removes the / from the include directory argument. Minor other changes: - The CRLF detection runs with -l, so GREP_COLORS wasn't doing anything; removed it. - The trailing whitespace test would trigger on CRLFs, but the CR would result in messed up output. Changed the test to just match trailing spaces and tabs, rather than all whitespace.
Jason Rhinelander committed -
The clang 4.0/cpp17 build wasn't enabling -flto because the system linker didn't like the output generated by clang for some reason. This switches the build to use llvm's lld instead, which lets -flto work again (and links considerably faster, too).
Jason Rhinelander committed
-
- 12 Jun, 2017 2 commits
-
-
numpy 1.13.0 fails with pypy 5.7.1, so this upgrades to 5.8.0. I've also uploaded pre-built .whl files to imaginary.ca (checked every 4 hours and rebuilt if needed), and list that as an extra pypi location under the pypy pip install to avoid the long travis pypy build times for a new release or branch.
Jason Rhinelander committed -
This commit allows multiple inheritance of pybind11 classes from Python, e.g. class MyType(Base1, Base2): def __init__(self): Base1.__init__(self) Base2.__init__(self) where Base1 and Base2 are pybind11-exported classes. This requires collapsing the various builtin base objects (pybind11_object_56, ...) introduced in 2.1 into a single pybind11_object of a fixed size; this fixed size object allocates enough space to contain either a simple object (one base class & small* holder instance), or a pointer to a new allocation that can contain an arbitrary number of base classes and holders, with holder size unrestricted. * "small" here means having a sizeof() of at most 2 pointers, which is enough to fit unique_ptr (sizeof is 1 ptr) and shared_ptr (sizeof is 2 ptrs). To minimize the performance impact, this repurposes `internals::registered_types_py` to store a vector of pybind-registered base types. For direct-use pybind types (e.g. the `PyA` for a C++ `A`) this is simply storing the same thing as before, but now in a vector; for Python-side inherited types, the map lets us avoid having to do a base class traversal as long as we've seen the class before. The change to vector is needed for multiple inheritance: Python types inheriting from multiple registered bases have one entry per base.Jason Rhinelander committed
-
- 10 Jun, 2017 3 commits
-
-
Fixes #896. From Python docs: "Once an iterator’s `__next__()` method raises `StopIteration`, it must continue to do so on subsequent calls. Implementations that do not obey this property are deemed broken."
Dean Moldovan committed -
pytest raises an error if it recurses into these directories.
Dean Moldovan committed -
Passing utf8 encoded strings from python to a C++ function taking a std::string was broken. The previous version was trying to call 'PyUnicode_FromObject' on this data, which failed to convert the string to unicode with the default ascii codec. Also this incurs an unnecessary conversion to unicode for data this is immediately converted back to utf8. Fix by treating python 2 strings the same python 3 bytes objects, and just copying over the data if possible.
Ben Frederickson committed
-
- 08 Jun, 2017 4 commits
-
-
libc++ 3.8 (and possibly others--including the derived version on OS X), doesn't define the macro, but does support std::experimental::optional. This removes the extra macro check and just assumes the header existing is enough, which is what we do for <optional> and <variant>.
Jason Rhinelander committed -
MSVC 2015 Update 3 and 2017 can handle enough expression SFINAE to make this work now.
Dean Moldovan committed -
Fix spelling
Matthew Chan committed -
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.
Jason Rhinelander committed
-
- 07 Jun, 2017 2 commits
-
-
[skip ci]
Dean Moldovan committed -
Fixes #887.
Dean Moldovan committed
-
- 06 Jun, 2017 1 commit
-
-
`accessor` currently relies on an implicit default copy constructor, but that is deprecated in C++11 when a copy assignment operator is present and can, in some cases, raise deprecation warnings (see #888). This commit explicitly specifies the default copy constructor and also adds a default move constructor.
eirrgang committed
-
- 31 May, 2017 1 commit
-
-
[skip ci]
Dean Moldovan committed
-
- 30 May, 2017 3 commits
-
-
This reimplements the std::reference_wrapper<T> caster to be a shell around the underlying T caster (rather than assuming T is a generic type), which lets it work for things like `std::reference_wrapper<int>` or anything else custom type caster with a lvalue cast operator. This also makes it properly fail when None is provided, just as an ordinary lvalue reference argument would similarly fail. This also adds a static assert to test that T has an appropriate type caster. It triggers for casters like `std::pair`, which have return-by-value cast operators. (In theory this could be supported by storing a local temporary for such types, but that's beyond the scope of this PR). This also replaces `automatic` or `take_ownership` return value policies with `automatic_reference` as taking ownership of a reference inside a reference_wrapper is not valid.
Jason Rhinelander committed -
test_issues is deprecated, and the following commit adds other, related reference_wrapper tests.
Jason Rhinelander committed -
The new version of pytest now reports Python warnings by default. This commit filters out some third-party extension warnings which are not useful for pybind11 tests.
Dean Moldovan committed
-
- 29 May, 2017 3 commits
-
-
This commit also adds `doc()` to `object_api` as a shortcut for the `attr("__doc__")` accessor. The module macro changes from: ```c++ PYBIND11_PLUGIN(example) { pybind11::module m("example", "pybind11 example plugin"); m.def("add", [](int a, int b) { return a + b; }); return m.ptr(); } ``` to: ```c++ PYBIND11_MODULE(example, m) { m.doc() = "pybind11 example plugin"; m.def("add", [](int a, int b) { return a + b; }); } ``` Using the old macro results in a deprecation warning. The warning actually points to the `pybind11_init` function (since attributes don't bind to macros), but the message should be quite clear: "PYBIND11_PLUGIN is deprecated, use PYBIND11_MODULE".Dean Moldovan committed -
* Added template constructors to buffer_info that can deduce the item size, format string, and number of dimensions from the pointer type and the shape container * Implemented actual buffer_info constructor as private delegate constructor taking rvalue reference as a workaround for the evaluation order move problem on GCC 4.8
Yannick Jadoul committed -
Fixes #878.
Dean Moldovan committed
-
- 28 May, 2017 5 commits
-
-
Dean Moldovan committed
-
Dean Moldovan committed
-
Dean Moldovan committed
-
At this point, there is only a single test for interpreter basics. Apart from embedding itself, having a C++ test framework will also benefit the C++-side features by allowing them to be tested directly.
Dean Moldovan committed -
All targets provided by pybind11: * pybind11::module - the existing target for creating extension modules * pybind11::embed - new target for embedding the interpreter * pybind11::pybind11 - common "base" target (headers only)
Dean Moldovan committed
-
- 27 May, 2017 2 commits
-
-
Now that #851 has removed all multiple uses of a caster, it can just use the default-constructed value with needing a reset. This fixes two issues: 1. With std::experimental::optional (at least under GCC 5.4), the `= {}` would construct an instance of the optional type and then move-assign it, which fails if the value type isn't move-assignable. 2. With older versions of Boost, the `= {}` could fail because it is ambiguous, allowing construction of either `boost::none` or the value type.Bruce Merry committed -
:exc: isn't valid.
Jason Rhinelander committed
-