* Add test_perf_accessors (to be merged into test_pytypes).
* Python < 3.8 f-string compatibility
* Use thread_local in inc_ref_counter()
* Intentional breakage, brute-force way to quickly find out how many platforms reach the PYBIND11_HANDLE_REF_DEBUG code, with and without threads.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Remove Intentional breakage
* Drop perf test, move inc_refs tests to test_pytypes
* Fold in PR #3970 with `#ifdef`s
* Complete test coverage for all newly added code.
* Condense new unit tests via a simple local helper macro.
* Remove PYBIND11_PR3970 define. See https://github.com/pybind/pybind11/pull/3977#issuecomment-1142526417
* Move static keyword first (fixes silly oversight).
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add missing error handling to module_::def_submodule
* Add test_def_submodule_failures
* PyPy only: Skip test with trigger for PyModule_GetName() failure.
* Reapply minor fix that accidentally got lost in transfer from PR #3964
* Add err guard to capsule destructor
* only uses ostream currently
* can these be noexcept
* Add back header
* fix for older compilers
* This should at least be noexcept
* Add missing move
* Apparently not noexcept for old llvm
* Add error_already_set_what what tests, asserting the status quo.
* Move PyErr_NormalizeException() up a few lines.
* @pytest.mark.skipif("env.PYPY") from PR #1895 is required even for this much simpler PR
* Move PyException_SetTraceback() with PyErr_NormalizeException() as suggested by @skylion007
* Insert a std::move() as suggested by @skylion007
* Use move converting ctor when making class staticmethod
* Add missing caster move in buffer func
* fix use after move
* add back move to staticmethod
* avoid shadowing with varname
* Don't return pointers to static objects with return_value_policy::take_ownership.
This fixes -Wfree-nonheap-object warnings produced by GCC.
* Use return value policy fix instead
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
* Transferred net diff from PR #3581, as-is.
* Automatic `pre-commit run --all-files` fixes. NO manual changes.
* Removing trailing `//` (originally added to manipulate clang-format), as suggested by @charlesbeattie back in Jan/Feb under PR #3581.
* Renaming `xetter_cpp_function` to `property_cpp_function` as suggested by @rainwoodman
* Fully explain the terse variable naming scheme in test_class_sh_property (as suggested by @rainwoodman)
* Also use parametrize for readonly, readwrite (as suggested by @rainwoodman)
* Apply change suggested by @skylion007 (with clang-format).
* Add missing std::moves in enum_base methods
* Remove useless move
* Add one more std::move in print
* Further optimize print
* Some more misc optimizations
* Fix py::cast from pytype rvalue to pytype
Previously, py::cast blindly assumed that the destination type was a C++
type rather than a python type when the source type was an rvalue.
* [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>
Fix the following warning seen with clang:
include/pybind11/detail/smart_holder_poc.h:109:2: error: extra ';' outside of a function is incompatible with C++98 [-Werror,-Wc++98-compat-extra-semi]
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
* Add frozenset, and allow it cast to std::set
For the reverse direction, std::set still casts to set. This is in concordance with the behavior for sequence containers, where e.g. tuple casts to std::vector but std::vector casts to list.
Extracted from #3886.
* Rename set_base to any_set to match Python C API
since this will be part of pybind11 public API
* PR: static_cast, anyset
* Add tests for frozenset
and rename anyset methods
* Remove frozenset default ctor, add tests
Making frozenset non-default constructible means that we need to adjust pyobject_caster to not require that its value is default constructible, by initializing value to a nil handle. This also allows writing C++ functions taking anyset, and is arguably a performance improvement, since there is no need to allocate an object that will just be replaced by load.
Add some more tests, including anyset::empty, anyset::size, set::add and set::clear.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add rationale to `pyobject_caster` default ctor
* Remove ineffectual protected: access control
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Test pickling a simple callable (does not work).
Currently only documents that it does not work. Starting point for future fix.
* Use re.search to accommodate variations of the TypeError message.
* PyPy: exercise full dumps/loads cycle.
* Adding explicit "broken" comment.
* Update cast.h
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Move definition to detail/common, change name, apply everywhere
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Rename debug_enabled in tests to detailed_error_messages_enabled