Skip to content

Commit 98aff18

Browse files
committed
t pushMerge branch 'master' of https://github.com/pybind/pybind11 into lazy-error-string
2 parents 6c6971f + e8e229f commit 98aff18

26 files changed

+524
-161
lines changed

.clang-tidy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ modernize-replace-random-shuffle,
2525
modernize-shrink-to-fit,
2626
modernize-use-auto,
2727
modernize-use-bool-literals,
28+
modernize-use-default-member-init,
2829
modernize-use-equals-default,
2930
modernize-use-equals-delete,
30-
modernize-use-default-member-init,
31-
modernize-use-noexcept,
3231
modernize-use-emplace,
32+
modernize-use-noexcept,
33+
modernize-use-nullptr,
3334
modernize-use-override,
3435
modernize-use-using,
3536
*performance*,

.github/workflows/ci.yml

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
- '3.10'
3333
- 'pypy-3.7'
3434
- 'pypy-3.8'
35+
- 'pypy-3.9'
3536

3637
# Items in here will either be added to the build matrix (if not
3738
# present), or add new keys to an existing matrix element if all the
@@ -45,6 +46,10 @@ jobs:
4546
args: >
4647
-DPYBIND11_FINDPYTHON=ON
4748
-DCMAKE_CXX_FLAGS="-D_=1"
49+
- runs-on: ubuntu-latest
50+
python: 'pypy-3.8'
51+
args: >
52+
-DPYBIND11_FINDPYTHON=ON
4853
- runs-on: windows-2019
4954
python: '3.6'
5055
args: >
@@ -668,7 +673,7 @@ jobs:
668673

669674

670675
# This verifies that the documentation is not horribly broken, and does a
671-
# basic sanity check on the SDist.
676+
# basic validation check on the SDist.
672677
doxygen:
673678
name: "Documentation build test"
674679
runs-on: ubuntu-latest
@@ -756,55 +761,60 @@ jobs:
756761
- name: Python tests
757762
run: cmake --build build -t pytest
758763

759-
win32-msvc2017:
760-
name: "🐍 ${{ matrix.python }} • MSVC 2017 • x64"
761-
runs-on: windows-2016
764+
win32-debug:
762765
strategy:
763766
fail-fast: false
764767
matrix:
765768
python:
766-
- 3.6
767-
- 3.7
768-
std:
769-
- 14
769+
- 3.8
770+
- 3.9
770771

771772
include:
772-
- python: 3.7
773-
std: 17
774-
args: >
775-
-DCMAKE_CXX_FLAGS="/permissive- /EHsc /GR"
773+
- python: 3.9
774+
args: -DCMAKE_CXX_STANDARD=20
775+
- python: 3.8
776+
args: -DCMAKE_CXX_STANDARD=17
777+
778+
name: "🐍 ${{ matrix.python }} • MSVC 2019 (Debug) • x86 ${{ matrix.args }}"
779+
runs-on: windows-2019
776780

777781
steps:
778782
- uses: actions/checkout@v2
779783

780-
- name: Setup 🐍 ${{ matrix.python }}
784+
- name: Setup Python ${{ matrix.python }}
781785
uses: actions/setup-python@v2
782786
with:
783787
python-version: ${{ matrix.python }}
788+
architecture: x86
784789

785790
- name: Update CMake
786791
uses: jwlawson/[email protected]
787792

793+
- name: Prepare MSVC
794+
uses: ilammy/[email protected]
795+
with:
796+
arch: x86
797+
788798
- name: Prepare env
789799
run: |
790800
python -m pip install -r tests/requirements.txt
791801
792802
# First build - C++11 mode and inplace
793-
- name: Configure
803+
- name: Configure ${{ matrix.args }}
794804
run: >
795805
cmake -S . -B build
796-
-G "Visual Studio 15 2017" -A x64
806+
-G "Visual Studio 16 2019" -A Win32
807+
-DCMAKE_BUILD_TYPE=Debug
797808
-DPYBIND11_WERROR=ON
798809
-DDOWNLOAD_CATCH=ON
799810
-DDOWNLOAD_EIGEN=ON
800-
-DCMAKE_CXX_STANDARD=${{ matrix.std }}
801811
${{ matrix.args }}
812+
- name: Build C++11
813+
run: cmake --build build --config Debug -j 2
802814

803-
- name: Build ${{ matrix.std }}
804-
run: cmake --build build -j 2
815+
- name: Python tests
816+
run: cmake --build build --config Debug -t pytest
805817

806-
- name: Run all checks
807-
run: cmake --build build -t check
808818

809819
windows-2022:
810820
strategy:

.github/workflows/configure.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
matrix:
1919
runs-on: [ubuntu-latest, macos-latest, windows-latest]
2020
arch: [x64]
21-
cmake: ["3.21"]
21+
cmake: ["3.23"]
2222

2323
include:
2424
- runs-on: ubuntu-latest
@@ -29,12 +29,8 @@ jobs:
2929
arch: x64
3030
cmake: 3.7
3131

32-
- runs-on: windows-2016
33-
arch: x86
34-
cmake: 3.8
35-
36-
- runs-on: windows-2016
37-
arch: x86
32+
- runs-on: windows-2019
33+
arch: x64 # x86 compilers seem to be missing on 2019 image
3834
cmake: 3.18
3935

4036
name: 🐍 3.7 • CMake ${{ matrix.cmake }} • ${{ matrix.runs-on }}

.pre-commit-config.yaml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
repos:
1616
# Standard hooks
1717
- repo: https://github.com/pre-commit/pre-commit-hooks
18-
rev: "v4.1.0"
18+
rev: "v4.2.0"
1919
hooks:
2020
- id: check-added-large-files
2121
- id: check-case-conflict
@@ -32,7 +32,7 @@ repos:
3232

3333
# Upgrade old Python syntax
3434
- repo: https://github.com/asottile/pyupgrade
35-
rev: "v2.31.0"
35+
rev: "v2.32.0"
3636
hooks:
3737
- id: pyupgrade
3838
args: [--py36-plus]
@@ -45,7 +45,7 @@ repos:
4545

4646
# Black, the code formatter, natively supports pre-commit
4747
- repo: https://github.com/psf/black
48-
rev: "22.1.0" # Keep in sync with blacken-docs
48+
rev: "22.3.0" # Keep in sync with blacken-docs
4949
hooks:
5050
- id: black
5151

@@ -55,7 +55,7 @@ repos:
5555
hooks:
5656
- id: blacken-docs
5757
additional_dependencies:
58-
- black==22.1.0 # keep in sync with black hook
58+
- black==22.3.0 # keep in sync with black hook
5959

6060
# Changes tabs to spaces
6161
- repo: https://github.com/Lucas-C/pre-commit-hooks
@@ -64,16 +64,17 @@ repos:
6464
- id: remove-tabs
6565

6666
- repo: https://github.com/sirosen/texthooks
67-
rev: "0.2.2"
67+
rev: "0.3.1"
6868
hooks:
6969
- id: fix-ligatures
7070
- id: fix-smartquotes
7171

7272
# Autoremoves unused imports
7373
- repo: https://github.com/hadialqattan/pycln
74-
rev: "v1.2.4"
74+
rev: "v1.3.1"
7575
hooks:
7676
- id: pycln
77+
stages: [manual]
7778

7879
# Checking for common mistakes
7980
- repo: https://github.com/pre-commit/pygrep-hooks
@@ -106,7 +107,7 @@ repos:
106107

107108
# PyLint has native support - not always usable, but works for us
108109
- repo: https://github.com/PyCQA/pylint
109-
rev: "v2.12.2"
110+
rev: "v2.13.5"
110111
hooks:
111112
- id: pylint
112113
files: ^pybind11
@@ -122,16 +123,16 @@ repos:
122123

123124
# Check static types with mypy
124125
- repo: https://github.com/pre-commit/mirrors-mypy
125-
rev: "v0.931"
126+
rev: "v0.942"
126127
hooks:
127128
- id: mypy
128-
args: [--show-error-codes]
129+
args: []
129130
exclude: ^(tests|docs)/
130131
additional_dependencies: [nox, rich]
131132

132133
# Checks the manifest for missing files (native support)
133134
- repo: https://github.com/mgedmin/check-manifest
134-
rev: "0.47"
135+
rev: "0.48"
135136
hooks:
136137
- id: check-manifest
137138
# This is a slow hook, so only run this if --hook-stage manual is passed
@@ -163,7 +164,7 @@ repos:
163164

164165
# Clang format the codebase automatically
165166
- repo: https://github.com/pre-commit/mirrors-clang-format
166-
rev: "v13.0.1"
167+
rev: "v14.0.1"
167168
hooks:
168169
- id: clang-format
169170
types_or: [c++, c, cuda]

docs/advanced/pycpp/numpy.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ buffer objects (e.g. a NumPy matrix).
8787
/* Request a buffer descriptor from Python */
8888
py::buffer_info info = b.request();
8989
90-
/* Some sanity checks ... */
90+
/* Some basic validation checks ... */
9191
if (info.format != py::format_descriptor<Scalar>::format())
9292
throw std::runtime_error("Incompatible format: expected a double array!");
9393

docs/changelog.rst

Lines changed: 120 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,129 @@ Changelog
66
Starting with version 1.8.0, pybind11 releases use a `semantic versioning
77
<http://semver.org>`_ policy.
88

9+
Changes will be added here periodically from the "Suggested changelog entry"
10+
block in pull request descriptions.
11+
912
IN DEVELOPMENT
1013
--------------
1114

12-
Changes will be added here periodically.
15+
Removed support for Python 2.7, Python 3.5, and MSVC 2015. Support for MSVC
16+
2017 is limited due to availability of CI runners; we highly recommend MSVC
17+
2019 or 2022 be used.
18+
19+
New features:
20+
21+
* ``type_caster<std::monostate>`` was added. ``std::monostate`` is a tag type
22+
that allows ``std::variant`` to act as an optional, or allows default
23+
construction of a ``std::variant`` holding a non-default constructible type.
24+
`#3818 <https://github.com/pybind/pybind11/pull/3818>`_
25+
26+
* Support bytearray casting to string.
27+
`#3707 <https://github.com/pybind/pybind11/pull/3707>`_
28+
29+
Changes:
30+
31+
* Python 2 support was removed completely.
32+
`#3688 <https://github.com/pybind/pybind11/pull/3688>`_
33+
34+
* The minimum version for MSVC is now 2017.
35+
`#3722 <https://github.com/pybind/pybind11/pull/3722>`_
36+
37+
* Improve exception handling in python ``str`` bindings.
38+
`#3826 <https://github.com/pybind/pybind11/pull/3826>`_
39+
40+
* The bindings for capsules now have more consistent exception handling.
41+
`#3825 <https://github.com/pybind/pybind11/pull/3825>`_
42+
43+
* Fix exception handling when ``pybind11::weakref()`` fails.
44+
`#3739 <https://github.com/pybind/pybind11/pull/3739>`_
45+
46+
47+
Bug fixes:
48+
49+
* ``PYBIND11_OBJECT_CVT`` and ``PYBIND11_OBJECT_CVT_DEFAULT`` macro can be used
50+
to define classes in namespaces other than pybind11.
51+
`#3797 <https://github.com/pybind/pybind11/pull/3797>`_
52+
53+
Build system improvements:
54+
55+
* Add MSVC builds in debug mode to CI.
56+
`#3784 <https://github.com/pybind/pybind11/pull/3784>`_
57+
58+
* MSVC 2022 C++20 coverage was added to GitHub Actions, including Eigen.
59+
`#3732 <https://github.com/pybind/pybind11/pull/3732>`_,
60+
`#3741 <https://github.com/pybind/pybind11/pull/3741>`_
61+
62+
* Avoid ``setup.py <command>`` usage in internal tests.
63+
`#3734 <https://github.com/pybind/pybind11/pull/3734>`_
64+
65+
66+
Backend and tidying up:
67+
68+
* Remove idioms in code comments. Use inclusive language.
69+
`#3809 <https://github.com/pybind/pybind11/pull/3809>`_
70+
71+
72+
Version 2.9.2 (Mar 29, 2022)
73+
----------------------------
74+
75+
Changes:
76+
77+
* Enum now has an ``__index__`` method on Python <3.8 too.
78+
`#3700 <https://github.com/pybind/pybind11/pull/3700>`_
79+
80+
* Local internals are now cleared after finalizing the interpreter.
81+
`#3744 <https://github.com/pybind/pybind11/pull/3744>`_
82+
83+
Bug fixes:
84+
85+
* Better support for Python 3.11 alphas.
86+
`#3694 <https://github.com/pybind/pybind11/pull/3694>`_
87+
88+
* ``PYBIND11_TYPE_CASTER`` now uses fully qualified symbols, so it can be used
89+
outside of ``pybind11::detail``.
90+
`#3758 <https://github.com/pybind/pybind11/pull/3758>`_
91+
92+
* Some fixes for PyPy 3.9.
93+
`#3768 <https://github.com/pybind/pybind11/pull/3768>`_
94+
95+
* Fixed a potential memleak in PyPy in ``get_type_override``.
96+
`#3774 <https://github.com/pybind/pybind11/pull/3774>`_
97+
98+
* Fix usage of ``VISIBILITY_INLINES_HIDDEN``.
99+
`#3721 <https://github.com/pybind/pybind11/pull/3721>`_
100+
101+
102+
Build system improvements:
103+
104+
* Uses ``sysconfig`` module to determine installation locations on Python >=
105+
3.10, instead of ``distutils`` which has been deprecated.
106+
`#3764 <https://github.com/pybind/pybind11/pull/3764>`_
107+
108+
* Support Catch 2.13.5+ (supporting GLIBC 2.34+).
109+
`#3679 <https://github.com/pybind/pybind11/pull/3679>`_
110+
111+
* Fix test failures with numpy 1.22 by ignoring whitespace when comparing
112+
``str()`` of dtypes.
113+
`#3682 <https://github.com/pybind/pybind11/pull/3682>`_
114+
115+
116+
Backend and tidying up:
117+
118+
* clang-tidy: added ``readability-qualified-auto``,
119+
``readability-braces-around-statements``,
120+
``cppcoreguidelines-prefer-member-initializer``,
121+
``clang-analyzer-optin.performance.Padding``,
122+
``cppcoreguidelines-pro-type-static-cast-downcast``, and
123+
``readability-inconsistent-declaration-parameter-name``.
124+
`#3702 <https://github.com/pybind/pybind11/pull/3702>`_,
125+
`#3699 <https://github.com/pybind/pybind11/pull/3699>`_,
126+
`#3716 <https://github.com/pybind/pybind11/pull/3716>`_,
127+
`#3709 <https://github.com/pybind/pybind11/pull/3709>`_
128+
129+
* clang-format was added to the pre-commit actions, and the entire code base
130+
automatically reformatted (after several iterations preparing for this leap).
131+
`#3713 <https://github.com/pybind/pybind11/pull/3713>`_
13132

14133

15134
Version 2.9.1 (Feb 2, 2022)

docs/compiling.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,10 @@ You can use these targets to build complex applications. For example, the
505505
target_link_libraries(example PRIVATE pybind11::module pybind11::lto pybind11::windows_extras)
506506
507507
pybind11_extension(example)
508-
pybind11_strip(example)
508+
if(NOT MSVC AND NOT ${CMAKE_BUILD_TYPE} MATCHES Debug|RelWithDebInfo)
509+
# Strip unnecessary sections of the binary on Linux/macOS
510+
pybind11_strip(example)
511+
endif()
509512
510513
set_target_properties(example PROPERTIES CXX_VISIBILITY_PRESET "hidden"
511514
CUDA_VISIBILITY_PRESET "hidden")

0 commit comments

Comments
 (0)