Merge branch 'master' into smart_holder

This commit is contained in:
Ralf W. Grosse-Kunstleve 2021-10-06 00:47:43 -07:00
commit 5a90dae7fe
9 changed files with 39 additions and 15 deletions

View File

@ -621,6 +621,7 @@ jobs:
if: matrix.centos == 8 if: matrix.centos == 8
run: echo Release > VAR_BUILD_TYPE run: echo Release > VAR_BUILD_TYPE
# Temporally disabling EIGEN due to SSL issue in CentOS 7
- name: Configure - name: Configure
shell: bash shell: bash
run: > run: >

View File

@ -34,7 +34,7 @@ repos:
exclude: ^noxfile.py$ exclude: ^noxfile.py$
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v2.28.0 rev: v2.29.0
hooks: hooks:
- id: pyupgrade - id: pyupgrade

View File

@ -6,8 +6,14 @@ Changelog
Starting with version 1.8.0, pybind11 releases use a `semantic versioning Starting with version 1.8.0, pybind11 releases use a `semantic versioning
<http://semver.org>`_ policy. <http://semver.org>`_ policy.
v2.8.0 (WIP)
------------ IN DEVELOPMENT
--------------
v2.8.0 (Oct 4, 2021)
--------------------
New features: New features:
@ -46,13 +52,17 @@ New features:
references instead of copies. references instead of copies.
`#3293 <https://github.com/pybind/pybind11/pull/3293>`_ `#3293 <https://github.com/pybind/pybind11/pull/3293>`_
* Improve the classes generated by ``bind_map``: `#3310 <https://github.com/pybind/pybind11/pull/3310>`_
* 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 * ``pybind11::custom_type_setup`` was added, for customizing the
``PyHeapTypeObject`` corresponding to a class, which may be useful for ``PyHeapTypeObject`` corresponding to a class, which may be useful for
enabling garbage collection support, among other things. enabling garbage collection support, among other things.
`#3287 <https://github.com/pybind/pybind11/pull/3287>`_ `#3287 <https://github.com/pybind/pybind11/pull/3287>`_
Changes: Changes:
* Set ``__file__`` constant when running ``eval_file`` in an embedded interpreter. * Set ``__file__`` constant when running ``eval_file`` in an embedded interpreter.
@ -106,6 +116,9 @@ Build system improvements:
* Fix a harmless warning from CMake 3.21 with the classic Python discovery. * Fix a harmless warning from CMake 3.21 with the classic Python discovery.
`#3220 <https://github.com/pybind/pybind11/pull/3220>`_ `#3220 <https://github.com/pybind/pybind11/pull/3220>`_
* Eigen repo and version can now be specified as cmake options.
`#3324 <https://github.com/pybind/pybind11/pull/3324>`_
Backend and tidying up: Backend and tidying up:

View File

@ -27,6 +27,7 @@ To release a new version of pybind11:
``include/pybind11/detail/common.h``. PATCH should be a simple integer. ``include/pybind11/detail/common.h``. PATCH should be a simple integer.
- Update the version HEX just below, as well. - Update the version HEX just below, as well.
- Update ``pybind11/_version.py`` (match above) - Update ``pybind11/_version.py`` (match above)
- Run ``nox -s tests_packaging``` to ensure this was done correctly.
- Ensure that all the information in ``setup.cfg`` is up-to-date, like - Ensure that all the information in ``setup.cfg`` is up-to-date, like
supported Python versions. supported Python versions.
- Add release date in ``docs/changelog.rst``. - Add release date in ``docs/changelog.rst``.
@ -64,6 +65,7 @@ To release a new version of pybind11:
- Update version macros in ``include/pybind11/detail/common.h`` (set PATCH to - Update version macros in ``include/pybind11/detail/common.h`` (set PATCH to
``0.dev1`` and increment MINOR). ``0.dev1`` and increment MINOR).
- Update ``_version.py`` to match - Update ``_version.py`` to match
- Run ``nox -s tests_packaging``` to ensure this was done correctly.
- Add a spot for in-development updates in ``docs/changelog.rst``. - Add a spot for in-development updates in ``docs/changelog.rst``.
- ``git add``, ``git commit``, ``git push`` - ``git add``, ``git commit``, ``git push``

View File

@ -10,12 +10,12 @@
#pragma once #pragma once
#define PYBIND11_VERSION_MAJOR 2 #define PYBIND11_VERSION_MAJOR 2
#define PYBIND11_VERSION_MINOR 8 #define PYBIND11_VERSION_MINOR 9
#define PYBIND11_VERSION_PATCH 0.dev2 #define PYBIND11_VERSION_PATCH 0.dev1
// Similar to Python's convention: https://docs.python.org/3/c-api/apiabiversion.html // Similar to Python's convention: https://docs.python.org/3/c-api/apiabiversion.html
// Additional convention: 0xD = dev // Additional convention: 0xD = dev
#define PYBIND11_VERSION_HEX 0x020800D2 #define PYBIND11_VERSION_HEX 0x020900D1
#define PYBIND11_NAMESPACE_BEGIN(name) namespace name { #define PYBIND11_NAMESPACE_BEGIN(name) namespace name {
#define PYBIND11_NAMESPACE_END(name) } #define PYBIND11_NAMESPACE_END(name) }

View File

@ -18,6 +18,7 @@
#include "detail/init.h" #include "detail/init.h"
#include "detail/smart_holder_sfinae_hooks_only.h" #include "detail/smart_holder_sfinae_hooks_only.h"
#include <cstdlib>
#include <memory> #include <memory>
#include <new> #include <new>
#include <vector> #include <vector>
@ -1624,7 +1625,7 @@ public:
char *doc_prev = rec_fget->doc; /* 'extra' field may include a property-specific documentation string */ char *doc_prev = rec_fget->doc; /* 'extra' field may include a property-specific documentation string */
detail::process_attributes<Extra...>::init(extra..., rec_fget); detail::process_attributes<Extra...>::init(extra..., rec_fget);
if (rec_fget->doc && rec_fget->doc != doc_prev) { if (rec_fget->doc && rec_fget->doc != doc_prev) {
free(doc_prev); std::free(doc_prev);
rec_fget->doc = PYBIND11_COMPAT_STRDUP(rec_fget->doc); rec_fget->doc = PYBIND11_COMPAT_STRDUP(rec_fget->doc);
} }
} }
@ -1632,7 +1633,7 @@ public:
char *doc_prev = rec_fset->doc; char *doc_prev = rec_fset->doc;
detail::process_attributes<Extra...>::init(extra..., rec_fset); detail::process_attributes<Extra...>::init(extra..., rec_fset);
if (rec_fset->doc && rec_fset->doc != doc_prev) { if (rec_fset->doc && rec_fset->doc != doc_prev) {
free(doc_prev); std::free(doc_prev);
rec_fset->doc = PYBIND11_COMPAT_STRDUP(rec_fset->doc); rec_fset->doc = PYBIND11_COMPAT_STRDUP(rec_fset->doc);
} }
if (! rec_active) rec_active = rec_fset; if (! rec_active) rec_active = rec_fset;

View File

@ -8,5 +8,5 @@ def _to_int(s):
return s return s
__version__ = "2.8.0.dev2" __version__ = "2.9.0.dev1"
version_info = tuple(_to_int(s) for s in __version__.split(".")) version_info = tuple(_to_int(s) for s in __version__.split("."))

View File

@ -189,6 +189,14 @@ set(PYBIND11_CROSS_MODULE_GIL_TESTS test_gil_scoped.py)
set(PYBIND11_CLASS_SH_MODULE_LOCAL_TESTS test_class_sh_module_local.py) set(PYBIND11_CLASS_SH_MODULE_LOCAL_TESTS test_class_sh_module_local.py)
set(PYBIND11_EIGEN_REPO
"https://gitlab.com/libeigen/eigen.git"
CACHE STRING "Eigen repository to use for tests")
# This hash is for 3.3.8, using a hash for security reasons
set(PYBIND11_EIGEN_VERSION
"dc252fbf00079ccab57948a164b1421703fe4361"
CACHE STRING "Eigen version to use for tests")
# Check if Eigen is available; if not, remove from PYBIND11_TEST_FILES (but # Check if Eigen is available; if not, remove from PYBIND11_TEST_FILES (but
# keep it in PYBIND11_PYTEST_FILES, so that we get the "eigen is not installed" # keep it in PYBIND11_PYTEST_FILES, so that we get the "eigen is not installed"
# skip message). # skip message).
@ -202,13 +210,11 @@ if(PYBIND11_TEST_FILES_EIGEN_I GREATER -1)
message(FATAL_ERROR "CMake 3.11+ required when using DOWNLOAD_EIGEN") message(FATAL_ERROR "CMake 3.11+ required when using DOWNLOAD_EIGEN")
endif() endif()
set(EIGEN3_VERSION_STRING "3.3.8")
include(FetchContent) include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
eigen eigen
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git GIT_REPOSITORY "${PYBIND11_EIGEN_REPO}"
GIT_TAG ${EIGEN3_VERSION_STRING}) GIT_TAG "${PYBIND11_EIGEN_VERSION}")
FetchContent_GetProperties(eigen) FetchContent_GetProperties(eigen)
if(NOT eigen_POPULATED) if(NOT eigen_POPULATED)

View File

@ -8,6 +8,7 @@
#include <catch.hpp> #include <catch.hpp>
#include <cstdlib>
#include <fstream> #include <fstream>
#include <functional> #include <functional>
#include <thread> #include <thread>
@ -315,7 +316,7 @@ TEST_CASE("sys.argv gets initialized properly") {
{ {
char *argv[] = {strdup("a.out")}; char *argv[] = {strdup("a.out")};
py::scoped_interpreter argv_scope(true, 1, argv); py::scoped_interpreter argv_scope(true, 1, argv);
free(argv[0]); std::free(argv[0]);
auto module = py::module::import("test_interpreter"); auto module = py::module::import("test_interpreter");
auto py_widget = module.attr("DerivedWidget")("The question"); auto py_widget = module.attr("DerivedWidget")("The question");
const auto &cpp_widget = py_widget.cast<const Widget &>(); const auto &cpp_widget = py_widget.cast<const Widget &>();