- 01 Jan, 2021 1 commit
-
-
Yannick Jadoul authored
* Fix leak in the test_copy_move::test_move_fallback * Fix leaking PyMethodDef in test_class::test_implicit_conversion_life_support * Plumb leak in test_buffer, occuring when a mutable buffer is requested for a read-only object, and enable test_buffer.py * Fix weird return_value_policy::reference in test_stl_binders, and enable those tests * Cleanup nodelete holder objects in test_smart_ptr, and enable those tests
-
- 31 Dec, 2020 2 commits
-
-
Yannick Jadoul authored
Fix invalid access when reinterpret_casting a non-pybind11 PyObject* to instance* (found by Valgrind in #2746) (#2755)
-
Eric Cousineau authored
* enum: Add Enum.value property * simplify * address review
-
- 28 Dec, 2020 1 commit
-
-
Qifan Lu authored
* Do not set docstring for function when it's empty * No need to check pointer for `free` * Use ternary operator to conditionally set `ml_doc`
-
- 19 Dec, 2020 1 commit
-
-
Nikita Shulga authored
* Avoid thread termination in scoped_released Do not call `PyEval_RestoreThread()` from `~gil_scoped_release()` if python runtime is finalizing, as it will result in thread termination in Python runtime newer than 3.6, as documented in https://docs.python.org/3/c-api/init.html#c.PyEval_RestoreThread Similarly do not call `PyThreadState_DeleteCurrent` from `~gil_scoped_acquire()` if runtime is finalizing. Discovered while debugging PyTorch crash using Python-3.9 described in https://github.com/pytorch/pytorch/issues/47776 * Simplify _Py_IsFinalizing() availability check * Fix typo * Add version agnostic `detail::finalization_guard()` * Move `finalization_guard` to detail/common.h And rename it to `is_finalizing` * Move `is_finalizing()` back to pybind11.h * Simplify `is_finalizing()` check One should follow documentation rather than make any assumptions * feat: disarm * docs: fix comment Co-authored-by:
Henry Schreiner <henryschreineriii@gmail.com>
-
- 16 Dec, 2020 3 commits
-
-
Yannick Jadoul authored
fix: also throw in the move-constructor added by the PYBIND11_OBJECT macro, after the argument has been moved-out (if necessary) (#2701)
-
Robert Haschke authored
which was just before set to True in instance->allocate_layout()
-
Laramie Leavitt authored
Adjusting `type_caster<std::reference_wrapper<T>>` to support const/non-const propagation in `cast_op`. (#2705) * Allow type_caster of std::reference_wrapper<T> to be the same as a native reference. Before, both std::reference_wrapper<T> and std::reference_wrapper<const T> would invoke cast_op<type>. This doesn't allow the type_caster<> specialization for T to distinguish reference_wrapper types from value types. After, the type_caster<> specialization invokes cast_op<type&>, which allows reference_wrapper to behave in the same way as a native reference type. * Add tests/examples for std::reference_wrapper<const T> * Add tests which use mutable/immutable variants This test is a chimera; it blends the pybind11 casters with a custom pytype implementation that supports immutable and mutable calls. In order to detect the immutable/mutable state, the cast_op needs to propagate it, even through e.g. std::reference<const T> Note: This is still a work in progress; some things are crashing, which likely means that I have a refcounting bug or something else missing. * Add/finish tests that distinguish const& from & Fixes the bugs in my custom python type implementation, demonstrate test that requires const& and reference_wrapper<const T> being treated differently from Non-const. * Add passing a const to non-const method. * Demonstrate non-const conversion of reference_wrapper in tests. Apply formatting presubmit check. * Fix build errors from presubmit checks. * Try and fix a few more CI errors * More CI fixes. * More CI fixups. * Try and get PyPy to work. * Additional minor fixups. Getting close to CI green. * More ci fixes? * fix clang-tidy warnings from presubmit * fix more clang-tidy warnings * minor comment and consistency cleanups * PyDECREF -> Py_DECREF * copy/move constructors * Resolve codereview comments * more review comment fixes * review comments: remove spurious & * Make the test fail even when the static_assert is commented out. This expands the test_freezable_type_caster a bit by: 1/ adding accessors .is_immutable and .addr to compare identity from python. 2/ Changing the default cast_op of the type_caster<> specialization to return a non-const value. In normal codepaths this is a reasonable default. 3/ adding roundtrip variants to exercise the by reference, by pointer and by reference_wrapper in all call paths. In conjunction with 2/, this demonstrates the failure case of the existing std::reference_wrpper conversion, which now loses const in a similar way that happens when using the default cast_op_type<>. * apply presubmit formatting * Revert inclusion of test_freezable_type_caster There's some concern that this test is a bit unwieldly because of the use of the raw <Python.h> functions. Removing for now. * Add a test that validates const references propagation. This test verifies that cast_op may be used to correctly detect const reference types when used with std::reference_wrapper. * mend * Review comments based changes. 1. std::add_lvalue_reference<type> -> type& 2. Simplify the test a little more; we're never returning the ConstRefCaster type so the class_ definition can be removed. * formatted files again. * Move const_ref_caster test to builtin_casters * Review comments: use cast_op and adjust some comments. * Simplify ConstRefCasted test I like this version better as it moves the assertion that matters back into python.
-
- 23 Nov, 2020 3 commits
-
-
Boris Staletic authored
-
albanD authored
-
Tobias Leibner authored
-
- 19 Nov, 2020 1 commit
-
-
nickbridgechess authored
* Added test_thread testing for ostream_redirect segfault recreation * fix: scoped_ostream_redirect str created outside gil * Moved threading tests into test_iostream. Cleaned up some formatting. Deleted test_thread.{cpp,py} * CI: few formatting fixes * CI: yet another formatting fix * CI: more formatting fixes. Removed unecessary comment * Ignore 'warning C4702: unreachable code' in MSVC 2015 Co-authored-by:Nick Bridge <nick.bridge.chess@gmail.com> Co-authored-by:
Nick Bridge <nbridge@jumptrading.com> Co-authored-by:
Yannick Jadoul <yannick.jadoul@belgacom.net>
-
- 12 Nov, 2020 1 commit
-
-
Henry Schreiner authored
-
- 11 Nov, 2020 1 commit
-
-
Henry Schreiner authored
-
- 10 Nov, 2020 1 commit
-
-
Yannick Jadoul authored
* Add argument names to enum_ methods * Add test_enum::test_docstring_signatures
-
- 09 Nov, 2020 1 commit
-
-
Robert Haschke authored
* style: clang-tidy: modernize-use-using * style: more clang-tidy checking Co-authored-by:Henry Schreiner <henryschreineriii@gmail.com>
-
- 05 Nov, 2020 1 commit
-
-
Boris Staletic authored
-
- 02 Nov, 2020 1 commit
-
-
Yannick Jadoul authored
-
- 29 Oct, 2020 1 commit
-
-
Thomas Köppe authored
-
- 27 Oct, 2020 1 commit
-
-
Yannick Jadoul authored
* Add __builtins__ to globals argument of `py::exec` and `py::eval` if not present * Refactor into inline ensure_builtins_in_globals function
-
- 21 Oct, 2020 3 commits
-
-
Wenzel Jakob authored
-
Wenzel Jakob authored
-
Boris Staletic authored
This line had two bugs: 1. It declares `py::detail::class_` as `friend`. 2. After fixing that, we would have to change it to `template <typename, typename...>` The first one was introduced ~5 years ago, when a large refactoring was made, probably as an intermediate step during refactoring. The second was made when `generic_type` was made to be agnostic with respect to the order of `py::class_` template parameters. We're removing the declaration altogether, because it was never relied on. This is what makes me think that it was an intermediate step in refactoring that shouldn't have ended up in commit history.
-
- 20 Oct, 2020 1 commit
-
-
Mana Borwornpadungkitti authored
* demo kwarg with none(false) * Reorder and extend tests for arg::none(false) in test_methods_and_attributes.py::test_accepts_none * Fix arg::none() for keyword arguments * Add changelog note * Fix names of no_none_kw test functions Co-authored-by:Yannick Jadoul <yannick.jadoul@belgacom.net>
-
- 16 Oct, 2020 3 commits
-
-
Henry Schreiner authored
-
Henry Schreiner authored
-
Yannick Jadoul authored
* Demonstrate test_factory_constructors.py failure without functional changes from #2335 * Revert "Demonstrate test_factory_constructors.py failure without functional changes from #2335" This reverts commit ca33a8021fc2a3617c3356b188796528f4594419. * Fix test crash where registered Python type gets garbage collected * Clean up some more internal structures when class objects go out of scope * Reduce length of std::erase_if-in-C++20 comment * Clean up code for cleaning up type internals * Move cleaning up of type info in internals to tp_dealloc on pybind11_metaclass
-
- 15 Oct, 2020 3 commits
-
-
Henry Schreiner authored
-
Henry Schreiner authored
-
Henry Schreiner authored
-
- 14 Oct, 2020 2 commits
-
-
Henry Schreiner authored
-
Yannick Jadoul authored
* Check if valgrind-detected after-freeing access of PyMethodDef causes macOS Python 3.9 segfaults * fix: only apply leak on 3.9.0 * fix: faster check * fix: better naming thanks to @bstaletic Co-authored-by:Henry Schreiner <henryschreineriii@gmail.com>
-
- 13 Oct, 2020 1 commit
-
-
Yannick Jadoul authored
* Throw error_already_set in py::len on failing PyObject_Length * Fix tests to mach error message on PyPy
-
- 12 Oct, 2020 2 commits
-
-
Yannick Jadoul authored
Shorten PYBIND11_EMBEDDED_MODULE macro implementation by using PYBIND11_CATCH_INIT_EXCEPTIONS (#2579)
-
Henry Schreiner authored
* fix: Intel 18+ fully supported * fix: Intel compiler workaround no longer needed Followup on #94 now that Intel 18+ is required.
-
- 09 Oct, 2020 4 commits
-
-
Henry Schreiner authored
-
Henry Schreiner authored
-
Ahmed Sobhy authored
* add support for LLVM compiler * Update include/pybind11/pybind11.h __forced_unwind libc++ vs libstdc++ Co-authored-by:
Henry Schreiner <HenrySchreinerIII@gmail.com> Co-authored-by:
Henry Schreiner <HenrySchreinerIII@gmail.com>
-
Yannick Jadoul authored
* Deprecated public constructors of module * Turn documentation comment of module_::add_object into valid doxygen documentation * Move definition of PYBIND11_DETAIL_MODULE_STATIC_DEF and PYBIND11_DETAIL_MODULE_CREATE macros up * Move detail::create_top_level_module to module_::create_extension_module, and unify Python 2 and 3 signature again * Throw error_already_set if module creation fails in module_::create_extension_module * Mention module_::create_extension_module in deprecation warning message of module_::module_
-
- 08 Oct, 2020 1 commit
-
-
Yannick Jadoul authored
* Check scope's __dict__ instead of using hasattr when registering classes and exceptions, to allow registering the same name in a derived class scope * Extend test_base_and_derived_nested_scope test * Add tests on error being thrown registering duplicate classes * Circumvent bug with combination of test_class.py::test_register_duplicate_class and test_factory_constructors.py::test_init_factory_alias
-