Skip to content

Commit 68cfd13

Browse files
committed
Merge remote-tracking branch 'upstream/master' into jiwaszki/warnings_feature
2 parents f4cf539 + a1d0091 commit 68cfd13

32 files changed

+790
-366
lines changed

.github/CONTRIBUTING.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ nox -s build
8181
### Full setup
8282

8383
To setup an ideal development environment, run the following commands on a
84-
system with CMake 3.14+:
84+
system with CMake 3.15+:
8585

8686
```bash
8787
python3 -m venv venv
@@ -96,8 +96,8 @@ Tips:
9696
* You can use `virtualenv` (faster, from PyPI) instead of `venv`.
9797
* You can select any name for your environment folder; if it contains "env" it
9898
will be ignored by git.
99-
* If you don't have CMake 3.14+, just add "cmake" to the pip install command.
100-
* You can use `-DPYBIND11_FINDPYTHON=ON` to use FindPython on CMake 3.12+
99+
* If you don't have CMake 3.15+, just add "cmake" to the pip install command.
100+
* You can use `-DPYBIND11_FINDPYTHON=ON` to use FindPython.
101101
* In classic mode, you may need to set `-DPYTHON_EXECUTABLE=/path/to/python`.
102102
FindPython uses `-DPython_ROOT_DIR=/path/to` or
103103
`-DPython_EXECUTABLE=/path/to/python`.
@@ -149,8 +149,8 @@ To run the tests, you can "build" the check target:
149149
cmake --build build --target check
150150
```
151151

152-
`--target` can be spelled `-t` in CMake 3.15+. You can also run individual
153-
tests with these targets:
152+
`--target` can be spelled `-t`. You can also run individual tests with these
153+
targets:
154154

155155
* `pytest`: Python tests only, using the
156156
[pytest](https://docs.pytest.org/en/stable/) framework

.github/workflows/configure.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ jobs:
3131
include:
3232
- runs-on: ubuntu-20.04
3333
arch: x64
34-
cmake: "3.5"
34+
cmake: "3.15"
3535

3636
- runs-on: ubuntu-20.04
3737
arch: x64
3838
cmake: "3.29"
3939

4040
- runs-on: macos-13
4141
arch: x64
42-
cmake: "3.8"
42+
cmake: "3.15"
4343

4444
- runs-on: windows-2019
4545
arch: x64 # x86 compilers seem to be missing on 2019 image

.github/workflows/emscripten.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
pull_request:
66
branches:
77
- master
8+
- stable
9+
- v*
810

911
concurrency:
1012
group: ${{ github.workflow }}-${{ github.ref }}
@@ -23,8 +25,6 @@ jobs:
2325
- uses: pypa/[email protected]
2426
env:
2527
PYODIDE_BUILD_EXPORTS: whole_archive
26-
CFLAGS: -fexceptions
27-
LDFLAGS: -fexceptions
2828
with:
2929
package-dir: tests
3030
only: cp312-pyodide_wasm32

.github/workflows/pip.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
- uses: actions/download-artifact@v4
103103

104104
- name: Generate artifact attestation for sdist and wheel
105-
uses: actions/attest-build-provenance@210c1913531870065f03ce1f9440dd87bc0938cd # v1.4.0
105+
uses: actions/attest-build-provenance@310b0a4a3b0b78ef57ecda988ee04b132db73ef8 # v1.4.1
106106
with:
107107
subject-path: "*/pybind11*"
108108

CMakeLists.txt

+10-47
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,15 @@ if(NOT CMAKE_VERSION VERSION_LESS "3.27")
1010
cmake_policy(GET CMP0148 _pybind11_cmp0148)
1111
endif()
1212

13-
cmake_minimum_required(VERSION 3.5)
14-
15-
# The `cmake_minimum_required(VERSION 3.5...3.29)` syntax does not work with
16-
# some versions of VS that have a patched CMake 3.11. This forces us to emulate
17-
# the behavior using the following workaround:
18-
if(${CMAKE_VERSION} VERSION_LESS 3.29)
19-
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
20-
else()
21-
cmake_policy(VERSION 3.29)
22-
endif()
13+
cmake_minimum_required(VERSION 3.15...3.30)
2314

2415
if(_pybind11_cmp0148)
2516
cmake_policy(SET CMP0148 ${_pybind11_cmp0148})
2617
unset(_pybind11_cmp0148)
2718
endif()
2819

2920
# Avoid infinite recursion if tests include this as a subdirectory
30-
if(DEFINED PYBIND11_MASTER_PROJECT)
31-
return()
32-
endif()
21+
include_guard(GLOBAL)
3322

3423
# Extract project version from source
3524
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/include/pybind11/detail/common.h"
@@ -74,14 +63,6 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
7463

7564
set(PYBIND11_MASTER_PROJECT ON)
7665

77-
if(OSX AND CMAKE_VERSION VERSION_LESS 3.7)
78-
# Bug in macOS CMake < 3.7 is unable to download catch
79-
message(WARNING "CMAKE 3.7+ needed on macOS to download catch, and newer HIGHLY recommended")
80-
elseif(WINDOWS AND CMAKE_VERSION VERSION_LESS 3.8)
81-
# Only tested with 3.8+ in CI.
82-
message(WARNING "CMAKE 3.8+ tested on Windows, previous versions untested")
83-
endif()
84-
8566
message(STATUS "CMake ${CMAKE_VERSION}")
8667

8768
if(CMAKE_CXX_STANDARD)
@@ -133,8 +114,7 @@ cmake_dependent_option(
133114
"Install pybind11 headers in Python include directory instead of default installation prefix"
134115
OFF "PYBIND11_INSTALL" OFF)
135116

136-
cmake_dependent_option(PYBIND11_FINDPYTHON "Force new FindPython" ${_pybind11_findpython_default}
137-
"NOT CMAKE_VERSION VERSION_LESS 3.12" OFF)
117+
option(PYBIND11_FINDPYTHON "Force new FindPython" ${_pybind11_findpython_default})
138118

139119
# Allow PYTHON_EXECUTABLE if in FINDPYTHON mode and building pybind11's tests
140120
# (makes transition easier while we support both modes).
@@ -184,7 +164,7 @@ set(PYBIND11_HEADERS
184164
include/pybind11/warnings.h)
185165

186166
# Compare with grep and warn if mismatched
187-
if(PYBIND11_MASTER_PROJECT AND NOT CMAKE_VERSION VERSION_LESS 3.12)
167+
if(PYBIND11_MASTER_PROJECT)
188168
file(
189169
GLOB_RECURSE _pybind11_header_check
190170
LIST_DIRECTORIES false
@@ -202,10 +182,7 @@ if(PYBIND11_MASTER_PROJECT AND NOT CMAKE_VERSION VERSION_LESS 3.12)
202182
endif()
203183
endif()
204184

205-
# CMake 3.12 added list(TRANSFORM <list> PREPEND
206-
# But we can't use it yet
207-
string(REPLACE "include/" "${CMAKE_CURRENT_SOURCE_DIR}/include/" PYBIND11_HEADERS
208-
"${PYBIND11_HEADERS}")
185+
list(TRANSFORM PYBIND11_HEADERS PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/")
209186

210187
# Cache variable so this can be used in parent projects
211188
set(pybind11_INCLUDE_DIR
@@ -275,25 +252,11 @@ if(PYBIND11_INSTALL)
275252
tools/${PROJECT_NAME}Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
276253
INSTALL_DESTINATION ${PYBIND11_CMAKECONFIG_INSTALL_DIR})
277254

278-
if(CMAKE_VERSION VERSION_LESS 3.14)
279-
# Remove CMAKE_SIZEOF_VOID_P from ConfigVersion.cmake since the library does
280-
# not depend on architecture specific settings or libraries.
281-
set(_PYBIND11_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
282-
unset(CMAKE_SIZEOF_VOID_P)
283-
284-
write_basic_package_version_file(
285-
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
286-
VERSION ${PROJECT_VERSION}
287-
COMPATIBILITY AnyNewerVersion)
288-
289-
set(CMAKE_SIZEOF_VOID_P ${_PYBIND11_CMAKE_SIZEOF_VOID_P})
290-
else()
291-
# CMake 3.14+ natively supports header-only libraries
292-
write_basic_package_version_file(
293-
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
294-
VERSION ${PROJECT_VERSION}
295-
COMPATIBILITY AnyNewerVersion ARCH_INDEPENDENT)
296-
endif()
255+
# CMake natively supports header-only libraries
256+
write_basic_package_version_file(
257+
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
258+
VERSION ${PROJECT_VERSION}
259+
COMPATIBILITY AnyNewerVersion ARCH_INDEPENDENT)
297260

298261
install(
299262
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake

docs/advanced/cast/eigen.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ copying to take place:
259259
"small"_a // <- This one can be copied if needed
260260
);
261261
262-
With the above binding code, attempting to call the the ``some_method(m)``
262+
With the above binding code, attempting to call the ``some_method(m)``
263263
method on a ``MyClass`` object, or attempting to call ``some_function(m, m2)``
264264
will raise a ``RuntimeError`` rather than making a temporary copy of the array.
265265
It will, however, allow the ``m2`` argument to be copied into a temporary if

docs/advanced/embedding.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ information, see :doc:`/compiling`.
1818

1919
.. code-block:: cmake
2020
21-
cmake_minimum_required(VERSION 3.5...3.29)
21+
cmake_minimum_required(VERSION 3.15...3.30)
2222
project(example)
2323
2424
find_package(pybind11 REQUIRED) # or `add_subdirectory(pybind11)`

docs/changelog.rst

+92
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,98 @@ IN DEVELOPMENT
1515

1616
Changes will be summarized here periodically.
1717

18+
New Features:
19+
20+
* Support for Python 3.7 was removed. (Official end-of-life: 2023-06-27).
21+
`#5191 <https://github.com/pybind/pybind11/pull/5191>`_
22+
23+
* stl.h ``list|set|map_caster`` were made more user friendly: it is no longer
24+
necessary to explicitly convert Python iterables to ``tuple()``, ``set()``,
25+
or ``map()`` in many common situations.
26+
`#4686 <https://github.com/pybind/pybind11/pull/4686>`_
27+
28+
* Support for CMake older than 3.15 removed. CMake 3.15-3.30 supported.
29+
`#5304 <https://github.com/pybind/pybind11/pull/5304>`_
30+
31+
Version 2.13.4 (August 14, 2024)
32+
--------------------------------
33+
34+
Bug fixes:
35+
36+
* Fix paths with spaces, including on Windows.
37+
(Replaces regression from `#5302 <https://github.com/pybind/pybind11/pull/5302>`_)
38+
`#4874 <https://github.com/pybind/pybind11/pull/4874>`_
39+
40+
Documentation:
41+
42+
* Remove repetitive words.
43+
`#5308 <https://github.com/pybind/pybind11/pull/5308>`_
44+
45+
46+
Version 2.13.3 (August 13, 2024)
47+
--------------------------------
48+
49+
Bug fixes:
50+
51+
* Quote paths from pybind11-config
52+
`#5302 <https://github.com/pybind/pybind11/pull/5302>`_
53+
54+
55+
* Fix typo in Emscripten support when in config mode (CMake)
56+
`#5301 <https://github.com/pybind/pybind11/pull/5301>`_
57+
58+
59+
Version 2.13.2 (August 13, 2024)
60+
--------------------------------
61+
62+
New Features:
63+
64+
* A ``pybind11::detail::type_caster_std_function_specializations`` feature was added, to support specializations for
65+
``std::function``'s with return types that require custom to-Python conversion behavior (to primary use case is to catch and
66+
convert exceptions).
67+
`#4597 <https://github.com/pybind/pybind11/pull/4597>`_
68+
69+
70+
Changes:
71+
72+
73+
* Use ``PyMutex`` instead of ``std::mutex`` for internal locking in the free-threaded build.
74+
`#5219 <https://github.com/pybind/pybind11/pull/5219>`_
75+
76+
* Add a special type annotation for C++ empty tuple.
77+
`#5214 <https://github.com/pybind/pybind11/pull/5214>`_
78+
79+
* When compiling for WebAssembly, add the required exception flags (CMake 3.13+).
80+
`#5298 <https://github.com/pybind/pybind11/pull/5298>`_
81+
82+
Bug fixes:
83+
84+
* Make ``gil_safe_call_once_and_store`` thread-safe in free-threaded CPython.
85+
`#5246 <https://github.com/pybind/pybind11/pull/5246>`_
86+
87+
* A missing ``#include <algorithm>`` in pybind11/typing.h was added to fix build errors (in case user code does not already depend
88+
on that include).
89+
`#5208 <https://github.com/pybind/pybind11/pull/5208>`_
90+
91+
* Fix regression introduced in #5201 for GCC<10.3 in C++20 mode.
92+
`#5205 <https://github.com/pybind/pybind11/pull/5205>`_
93+
94+
95+
.. fix(cmake)
96+
97+
* Remove extra = when assigning flto value in the case for Clang in CMake.
98+
`#5207 <https://github.com/pybind/pybind11/pull/5207>`_
99+
100+
101+
Tests:
102+
103+
* Adding WASM testing to our CI (Pyodide / Emscripten via scikit-build-core).
104+
`#4745 <https://github.com/pybind/pybind11/pull/4745>`_
105+
106+
* clang-tidy (in GitHub Actions) was updated from clang 15 to clang 18.
107+
`#5272 <https://github.com/pybind/pybind11/pull/5272>`_
108+
109+
18110
Version 2.13.1 (June 26, 2024)
19111
------------------------------
20112

0 commit comments

Comments
 (0)