The simple namespace creation shortcut added in 2.8.0 was deprecated due to usage of CPython internal API, and will be removed soon. Use py::module_::import("types").attr("SimpleNamespace"). #3374
Add C++ Exception type to throw and catch AttributeError. Useful for defining custom __setattr__ and __getattr__ methods. #3387
Fixes:
Fixed the potential for dangling references when using properties with std::optional types. #3376
Modernize usage of PyCodeObject on Python 3.9+ (moving toward support for Python 3.11a1) #3368
A long-standing bug in eigen.h was fixed (originally PR #3343). The bug was unmasked by newly added static_assert's in the Eigen 3.4.0 release. #3352
Support multiple raw inclusion of CMake helper files (Conan.io does this for multi-config generators). #3420
Fix harmless warning on upcoming CMake 3.22. #3368
Fix 2.8.0 regression that caused undefined behavior (typically segfaults) in make_key_iterator/make_value_iterator if dereferencing the iterator returned a temporary value instead of a reference. #3348
Version 2.8.0
New features:
Added py::raise_from to enable chaining exceptions. #3215
Allow exception translators to be optionally registered local to a module instead of applying globally across all pybind11 modules. Use register_local_exception_translator(ExceptionTranslator&& translator) instead of register_exception_translator(ExceptionTranslator&& translator) to keep your exception remapping code local to the module. #2650
Add make_simple_namespace function for instantiating Python SimpleNamespace objects. #2840
pybind11::scoped_interpreter and initialize_interpreter have new arguments to allow sys.argv initialization. #2341
Allow Python builtins to be used as callbacks in CPython. #1413
Added view to view arrays with a different datatype. #987
Change .items from an iterator to a dictionary view.
Add .keys and .values (both dictionary views).
Allow __contains__ to take any object.
pybind11::custom_type_setup was added, for customizing the PyHeapTypeObject corresponding to a class, which may be useful for enabling garbage collection support, among other things. #3287
Changes:
Set __file__ constant when running eval_file in an embedded interpreter. #3233
Python objects and (C++17) std::optional now accepted in py::slice constructor. #1101
The pybind11 proxy types str, bytes, bytearray, tuple, list now consistently support passing ssize_t values for sizes and indexes. Previously, only size_t was accepted in several interfaces. #3219
Avoid evaluating PYBIND11_TLS_REPLACE_VALUE arguments more than once. #3290
Fixes:
Bug fix: enum value's __int__ returning non-int when underlying type is bool or of char type #1334
Fixes bug in setting error state in Capsule's pointer methods. #3261
A long-standing memory leak in py::cpp_function::initialize was fixed. #3229
Fixes thread safety for some pybind11::type_caster which require lifetime extension, such as for std::string_view. #3237
Restore compatibility with gcc 4.8.4 as distributed by ubuntu-trusty, linuxmint-17. #3270
The simple namespace creation shortcut added in 2.8.0 was deprecated due to
usage of CPython internal API, and will be removed soon. Use
py::module_::import("types").attr("SimpleNamespace").
[#3374](https://github.com/pybind/pybind11/issues/3374) <https://github.com/pybinyyd/pybind11/pull/3374>_
Add C++ Exception type to throw and catch AttributeError. Useful for
defining custom __setattr__ and __getattr__ methods.
[#3387](https://github.com/pybind/pybind11/issues/3387) <https://github.com/pybind/pybind11/pull/3387>_
Fixes:
Fixed the potential for dangling references when using properties with
std::optional types.
[#3376](https://github.com/pybind/pybind11/issues/3376) <https://github.com/pybind/pybind11/pull/3376>_
Modernize usage of PyCodeObject on Python 3.9+ (moving toward support for
Python 3.11a1)
[#3368](https://github.com/pybind/pybind11/issues/3368) <https://github.com/pybind/pybind11/pull/3368>_
A long-standing bug in eigen.h was fixed (originally PR #3343). The bug
was unmasked by newly added static_assert's in the Eigen 3.4.0 release.
[#3352](https://github.com/pybind/pybind11/issues/3352) <https://github.com/pybind/pybind11/pull/3352>_
Support multiple raw inclusion of CMake helper files (Conan.io does this for
multi-config generators).
[#3420](https://github.com/pybind/pybind11/issues/3420) <https://github.com/pybind/pybind11/pull/3420>_
Fix harmless warning on upcoming CMake 3.22.
[#3368](https://github.com/pybind/pybind11/issues/3368) <https://github.com/pybind/pybind11/pull/3368>_
Fix 2.8.0 regression that caused undefined behavior (typically
segfaults) in make_key_iterator/make_value_iterator if dereferencing
the iterator returned a temporary value instead of a reference.
[#3348](https://github.com/pybind/pybind11/issues/3348) <https://github.com/pybind/pybind11/pull/3348>_
v2.8.0 (Oct 4, 2021)
New features:
Added py::raise_from to enable chaining exceptions.
... (truncated)
Commits
f7b4996 [skip ci] Tweaks in preparation for the 2.8.1 release. (#3421)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps pybind11 from 2.7.1 to 2.8.1.
Release notes
Sourced from pybind11's releases.
... (truncated)
Changelog
Sourced from pybind11's changelog.
... (truncated)
Commits
f7b4996
[skip ci] Tweaks in preparation for the 2.8.1 release. (#3421)f1594cb
docs: changelog update for 2.8.1 (#3416)90707b4
fix(build): support conan's multiple includes of all files (#3420)e7e2c79
fix: improve support for Python 3.11-dev (#3368)c2d3e22
fix: the types for return_value_policy_override in optional_caster (#3376)d45a881
[pre-commit.ci] pre-commit autoupdate (#3409)9379b39
fix: MSVC 2017 C++17 on Python 3 regression (#3407)78ee782
feat: Add C++ binding to throw AttributeError (#3387)076c89f
tests: test recursive dispatch using visitor pattern (#3365)606f81a
style: drop pycln (#3397)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)