From 90707b46f25a22d53fe2716ba3e575653a923cf1 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 27 Oct 2021 15:06:02 -0400 Subject: [PATCH 1/4] fix(build): support conan's multiple includes of all files (#3420) --- tools/pybind11Common.cmake | 1 + tools/pybind11NewTools.cmake | 10 ++++++---- tools/pybind11Tools.cmake | 5 +++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/pybind11Common.cmake b/tools/pybind11Common.cmake index 7afb0d0b1..69ac4b0f6 100644 --- a/tools/pybind11Common.cmake +++ b/tools/pybind11Common.cmake @@ -20,6 +20,7 @@ Adds the following functions:: #]======================================================] # CMake 3.10 has an include_guard command, but we can't use that yet +# include_guard(global) (pre-CMake 3.10) if(TARGET pybind11::lto) return() endif() diff --git a/tools/pybind11NewTools.cmake b/tools/pybind11NewTools.cmake index 0a7b84706..9e2fd2b40 100644 --- a/tools/pybind11NewTools.cmake +++ b/tools/pybind11NewTools.cmake @@ -5,6 +5,12 @@ # All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. +if(CMAKE_VERSION VERSION_LESS 3.12) + message(FATAL_ERROR "You cannot use the new FindPython module with CMake < 3.12") +endif() + +include_guard(GLOBAL) + get_property( is_config TARGET pybind11::headers @@ -16,10 +22,6 @@ else() set(_pybind11_quiet "") endif() -if(CMAKE_VERSION VERSION_LESS 3.12) - message(FATAL_ERROR "You cannot use the new FindPython module with CMake < 3.12") -endif() - if(NOT Python_FOUND AND NOT Python3_FOUND AND NOT Python2_FOUND) diff --git a/tools/pybind11Tools.cmake b/tools/pybind11Tools.cmake index 026069c73..c255e5cfd 100644 --- a/tools/pybind11Tools.cmake +++ b/tools/pybind11Tools.cmake @@ -5,6 +5,11 @@ # All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. +# include_guard(global) (pre-CMake 3.10) +if(TARGET pybind11::python_headers) + return() +endif() + # Built-in in CMake 3.5+ include(CMakeParseArguments) From f1594cb9609ba4e3b931616815195655ac25e1d0 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 27 Oct 2021 15:08:59 -0400 Subject: [PATCH 2/4] docs: changelog update for 2.8.1 (#3416) * docs: changelog update for 2.8.1 * chore: add one more entry * [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> --- docs/changelog.rst | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index ee79a1871..f54512174 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -10,11 +10,49 @@ Starting with version 1.8.0, pybind11 releases use a `semantic versioning IN DEVELOPMENT -------------- +v2.8.0 (Oct 27, 2021) +--------------------- + +Changes and additions: + * 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 with MSVC 2017 + C++17 mode + Python 3. + `#3407 `_ + +* 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 `_ + v2.8.0 (Oct 4, 2021) -------------------- From f7b499615e14d70ab098a20deb0cdb3889998a1a Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 27 Oct 2021 14:35:10 -0700 Subject: [PATCH 3/4] [skip ci] Tweaks in preparation for the 2.8.1 release. (#3421) --- docs/changelog.rst | 2 +- docs/release.rst | 22 ++++++++++++---------- include/pybind11/detail/common.h | 6 +++--- pybind11/_version.py | 2 +- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index f54512174..bb5457eec 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -10,7 +10,7 @@ Starting with version 1.8.0, pybind11 releases use a `semantic versioning IN DEVELOPMENT -------------- -v2.8.0 (Oct 27, 2021) +v2.8.1 (Oct 27, 2021) --------------------- Changes and additions: diff --git a/docs/release.rst b/docs/release.rst index 7fa254eaf..b5de60f4e 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -27,7 +27,7 @@ To release a new version of pybind11: ``include/pybind11/detail/common.h``. PATCH should be a simple integer. - Update the version HEX just below, as well. - Update ``pybind11/_version.py`` (match above) - - Run ``nox -s tests_packaging``` to ensure this was done correctly. + - Run ``nox -s tests_packaging`` to ensure this was done correctly. - Ensure that all the information in ``setup.cfg`` is up-to-date, like supported Python versions. - Add release date in ``docs/changelog.rst``. @@ -50,13 +50,15 @@ To release a new version of pybind11: - Make a GitHub release (this shows up in the UI, sends new release notifications to users watching releases, and also uploads PyPI packages). (Note: if you do not use an existing tag, this creates a new lightweight tag - for you, so you could skip the above step). - - GUI method: click "Create a new release" on the far right, fill in the tag - name (if you didn't tag above, it will be made here), fill in a release - name like "Version X.Y.Z", and optionally copy-and-paste the changelog into - the description (processed as markdown by Pandoc). Check "pre-release" if - this is a beta/RC. You can get partway there with - ``cat docs/changelog.rst | pandoc -f rst -t gfm``. + for you, so you could skip the above step.) + + - GUI method: Under `releases `_ + click "Draft a new release" on the far right, fill in the tag name + (if you didn't tag above, it will be made here), fill in a release name + like "Version X.Y.Z", and copy-and-paste the markdown-formatted (!) changelog + into the description (usually ``cat docs/changelog.rst | pandoc -f rst -t gfm``). + Check "pre-release" if this is a beta/RC. + - CLI method: with ``gh`` installed, run ``gh release create vX.Y.Z -t "Version X.Y.Z"`` If this is a pre-release, add ``-p``. @@ -65,7 +67,7 @@ To release a new version of pybind11: - Update version macros in ``include/pybind11/detail/common.h`` (set PATCH to ``0.dev1`` and increment MINOR). - Update ``_version.py`` to match - - Run ``nox -s tests_packaging``` to ensure this was done correctly. + - Run ``nox -s tests_packaging`` to ensure this was done correctly. - Add a spot for in-development updates in ``docs/changelog.rst``. - ``git add``, ``git commit``, ``git push`` @@ -73,7 +75,7 @@ If a version branch is updated, remember to set PATCH to ``1.dev1``. If you'd like to bump homebrew, run: -.. code-block:: +.. code-block:: console brew bump-formula-pr --url https://github.com/pybind/pybind11/archive/vX.Y.Z.tar.gz diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index 862451fd1..713de94b0 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -10,12 +10,12 @@ #pragma once #define PYBIND11_VERSION_MAJOR 2 -#define PYBIND11_VERSION_MINOR 9 -#define PYBIND11_VERSION_PATCH 0.dev1 +#define PYBIND11_VERSION_MINOR 8 +#define PYBIND11_VERSION_PATCH 1 // Similar to Python's convention: https://docs.python.org/3/c-api/apiabiversion.html // Additional convention: 0xD = dev -#define PYBIND11_VERSION_HEX 0x020900D1 +#define PYBIND11_VERSION_HEX 0x02080100 #define PYBIND11_NAMESPACE_BEGIN(name) namespace name { #define PYBIND11_NAMESPACE_END(name) } diff --git a/pybind11/_version.py b/pybind11/_version.py index ce894a774..7cc100286 100644 --- a/pybind11/_version.py +++ b/pybind11/_version.py @@ -8,5 +8,5 @@ def _to_int(s): return s -__version__ = "2.9.0.dev1" +__version__ = "2.8.1" version_info = tuple(_to_int(s) for s in __version__.split(".")) From a80b22374ae9398962fe9746f84edc7e7982f9f7 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 27 Oct 2021 15:15:11 -0700 Subject: [PATCH 4/4] chore: get back to work after 2.8.1 [skip ci] --- include/pybind11/detail/common.h | 6 +++--- pybind11/_version.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index 713de94b0..862451fd1 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -10,12 +10,12 @@ #pragma once #define PYBIND11_VERSION_MAJOR 2 -#define PYBIND11_VERSION_MINOR 8 -#define PYBIND11_VERSION_PATCH 1 +#define PYBIND11_VERSION_MINOR 9 +#define PYBIND11_VERSION_PATCH 0.dev1 // Similar to Python's convention: https://docs.python.org/3/c-api/apiabiversion.html // Additional convention: 0xD = dev -#define PYBIND11_VERSION_HEX 0x02080100 +#define PYBIND11_VERSION_HEX 0x020900D1 #define PYBIND11_NAMESPACE_BEGIN(name) namespace name { #define PYBIND11_NAMESPACE_END(name) } diff --git a/pybind11/_version.py b/pybind11/_version.py index 7cc100286..ce894a774 100644 --- a/pybind11/_version.py +++ b/pybind11/_version.py @@ -8,5 +8,5 @@ def _to_int(s): return s -__version__ = "2.8.1" +__version__ = "2.9.0.dev1" version_info = tuple(_to_int(s) for s in __version__.split("."))