Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[smart_holder] git merge master #4347

Merged
merged 11 commits into from
Nov 18, 2022
Merged
137 changes: 137 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -968,3 +968,140 @@ jobs:

- name: Interface test C++17
run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build3 --target test_cmake_build

windows_clang:

strategy:
matrix:
os: [windows-latest]
python: ['3.10']

runs-on: "${{ matrix.os }}"

name: "🐍 ${{ matrix.python }} • ${{ matrix.os }} • clang-latest"

steps:
- name: Show env
run: env

- name: Checkout
uses: actions/checkout@v3

- name: Set up Clang
uses: egor-tensin/setup-clang@v1

- name: Setup Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

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

- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@v3

- name: Run pip installs
run: |
python -m pip install --upgrade pip
python -m pip install -r tests/requirements.txt

- name: Show Clang++ version
run: clang++ --version

- name: Show CMake version
run: cmake --version

# TODO: WERROR=ON
- name: Configure Clang
run: >
cmake -G Ninja -S . -B .
-DCMAKE_VERBOSE_MAKEFILE=ON
-DPYBIND11_WERROR=OFF
-DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF
-DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_CXX_STANDARD=17

- name: Build
run: cmake --build . -j 2

- name: Python tests
run: cmake --build . --target pytest -j 2

- name: C++ tests
run: cmake --build . --target cpptest -j 2

- name: Interface test
run: cmake --build . --target test_cmake_build -j 2

- name: Clean directory
run: git clean -fdx

macos_brew_install_llvm:
name: "macos-latest • brew install llvm"
runs-on: macos-latest

env:
# https://apple.stackexchange.com/questions/227026/how-to-install-recent-clang-with-homebrew
LDFLAGS: '-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib'

steps:
- name: Update PATH
run: echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH

- name: Show env
run: env

- name: Checkout
uses: actions/checkout@v3

- name: Show Clang++ version before brew install llvm
run: clang++ --version

- name: brew install llvm
run: brew install llvm

- name: Show Clang++ version after brew install llvm
run: clang++ --version

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

- name: Run pip installs
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r tests/requirements.txt
python3 -m pip install numpy
python3 -m pip install scipy

- name: Show CMake version
run: cmake --version

- name: CMake Configure
run: >
cmake -S . -B .
-DCMAKE_VERBOSE_MAKEFILE=ON
-DPYBIND11_WERROR=ON
-DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF
-DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_CXX_STANDARD=17
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")

- name: Build
run: cmake --build . -j 2

- name: Python tests
run: cmake --build . --target pytest -j 2

- name: C++ tests
run: cmake --build . --target cpptest -j 2

- name: Interface test
run: cmake --build . --target test_cmake_build -j 2

- name: Clean directory
run: git clean -fdx
139 changes: 139 additions & 0 deletions .github/workflows/ci_sh_def.yml
Original file line number Diff line number Diff line change
Expand Up @@ -994,3 +994,142 @@ jobs:

- name: Interface test C++17
run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build3 --target test_cmake_build

windows_clang:

strategy:
matrix:
os: [windows-latest]
python: ['3.10']

runs-on: "${{ matrix.os }}"

name: "🐍 ${{ matrix.python }} • ${{ matrix.os }} • clang-latest"

steps:
- name: Show env
run: env

- name: Checkout
uses: actions/checkout@v3

- name: Set up Clang
uses: egor-tensin/setup-clang@v1

- name: Setup Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

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

- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@v3

- name: Run pip installs
run: |
python -m pip install --upgrade pip
python -m pip install -r tests/requirements.txt

- name: Show Clang++ version
run: clang++ --version

- name: Show CMake version
run: cmake --version

# TODO: WERROR=ON
- name: Configure Clang
run: >
cmake -G Ninja -S . -B .
-DCMAKE_VERBOSE_MAKEFILE=ON
-DPYBIND11_WERROR=OFF
-DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF
-DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_CXX_STANDARD=17
-DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"

- name: Build
run: cmake --build . -j 2

- name: Python tests
run: cmake --build . --target pytest -j 2

- name: C++ tests
run: cmake --build . --target cpptest -j 2

- name: Interface test
run: cmake --build . --target test_cmake_build -j 2

- name: Clean directory
run: git clean -fdx

macos_brew_install_llvm:
name: "macos-latest • brew install llvm"
runs-on: macos-latest

env:
# https://apple.stackexchange.com/questions/227026/how-to-install-recent-clang-with-homebrew
LDFLAGS: '-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib'

steps:
- name: Update PATH
run: echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH

- name: Show env
run: env

- name: Checkout
uses: actions/checkout@v3

- name: Show Clang++ version before brew install llvm
run: clang++ --version

- name: brew install llvm
run: brew install llvm

- name: Show Clang++ version after brew install llvm
run: clang++ --version

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

- name: Run pip installs
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r tests/requirements.txt
python3 -m pip install numpy
python3 -m pip install scipy

- name: Show CMake version
run: cmake --version

- name: CMake Configure
run: >
cmake -S . -B .
-DCMAKE_VERBOSE_MAKEFILE=ON
-DPYBIND11_WERROR=ON
-DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF
-DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_CXX_STANDARD=17
-DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")

- name: Build
run: cmake --build . -j 2

- name: Python tests
run: cmake --build . --target pytest -j 2

- name: C++ tests
run: cmake --build . --target cpptest -j 2

- name: Interface test
run: cmake --build . --target test_cmake_build -j 2

- name: Clean directory
run: git clean -fdx
20 changes: 18 additions & 2 deletions .github/workflows/ci_sh_def.yml.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- ci.yml 2022-10-30 13:26:32.377345870 -0700
+++ ci_sh_def.yml 2022-10-30 13:32:48.125051576 -0700
--- ci.yml 2022-11-18 08:56:49.472080960 -0800
+++ ci_sh_def.yml 2022-11-18 09:00:36.986976092 -0800
@@ -1,4 +1,16 @@
-name: CI
+# PLEASE KEEP THIS GROUP OF FILES IN SYNC AT ALL TIMES:
Expand Down Expand Up @@ -177,3 +177,19 @@

- name: Build C++17
run: cmake --build build3 -j 2
@@ -1023,6 +1049,7 @@
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_CXX_STANDARD=17
+ -DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"

- name: Build
run: cmake --build . -j 2
@@ -1089,6 +1116,7 @@
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_CXX_STANDARD=17
+ -DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")

- name: Build
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ repos:

# Upgrade old Python syntax
- repo: https://github.com/asottile/pyupgrade
rev: "v2.38.2"
rev: "v3.2.0"
hooks:
- id: pyupgrade
args: [--py36-plus]
Expand All @@ -55,7 +55,7 @@ repos:

# Black, the code formatter, natively supports pre-commit
- repo: https://github.com/psf/black
rev: "22.8.0" # Keep in sync with blacken-docs
rev: "22.10.0" # Keep in sync with blacken-docs
hooks:
- id: black

Expand All @@ -65,7 +65,7 @@ repos:
hooks:
- id: blacken-docs
additional_dependencies:
- black==22.8.0 # keep in sync with black hook
- black==22.10.0 # keep in sync with black hook

# Changes tabs to spaces
- repo: https://github.com/Lucas-C/pre-commit-hooks
Expand Down Expand Up @@ -119,7 +119,7 @@ repos:

# PyLint has native support - not always usable, but works for us
- repo: https://github.com/PyCQA/pylint
rev: "v2.15.3"
rev: "v2.15.5"
hooks:
- id: pylint
files: ^pybind11
Expand All @@ -135,7 +135,7 @@ repos:

# Check static types with mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v0.981"
rev: "v0.982"
hooks:
- id: mypy
args: []
Expand All @@ -155,7 +155,7 @@ repos:
# Use tools/codespell_ignore_lines_from_errors.py
# to rebuild .codespell-ignore-lines
- repo: https://github.com/codespell-project/codespell
rev: "v2.2.1"
rev: "v2.2.2"
hooks:
- id: codespell
exclude: ".supp$"
Expand Down
9 changes: 6 additions & 3 deletions docs/advanced/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,12 @@ section.
may be explicitly (re-)thrown to delegate it to the other,
previously-declared existing exception translators.

Note that ``libc++`` and ``libstdc++`` `behave differently <https://stackoverflow.com/questions/19496643/using-clang-fvisibility-hidden-and-typeinfo-and-type-erasure/28827430>`_
with ``-fvisibility=hidden``. Therefore exceptions that are used across ABI boundaries need to be explicitly exported, as exercised in ``tests/test_exceptions.h``.
See also: "Problems with C++ exceptions" under `GCC Wiki <https://gcc.gnu.org/wiki/Visibility>`_.
Note that ``libc++`` and ``libstdc++`` `behave differently under macOS
<https://stackoverflow.com/questions/19496643/using-clang-fvisibility-hidden-and-typeinfo-and-type-erasure/28827430>`_
with ``-fvisibility=hidden``. Therefore exceptions that are used across ABI
boundaries need to be explicitly exported, as exercised in
``tests/test_exceptions.h``. See also:
"Problems with C++ exceptions" under `GCC Wiki <https://gcc.gnu.org/wiki/Visibility>`_.


Local vs Global Exception Translators
Expand Down
Loading