mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-28 08:02:00 +00:00
Merge branch 'master' into master_with_dummy_change
This commit is contained in:
commit
a253b4e0c0
9
.github/labeler.yml
vendored
9
.github/labeler.yml
vendored
@ -1,8 +1,13 @@
|
||||
docs:
|
||||
- any:
|
||||
- 'docs/**/*.rst'
|
||||
all:
|
||||
- changed-files:
|
||||
- all-globs-to-all-files:
|
||||
- '!docs/changelog.rst'
|
||||
- '!docs/upgrade.rst'
|
||||
- base-branch: "^(?!dependabot).*"
|
||||
- base-branch: "^(?!pre-commit-ci).*"
|
||||
|
||||
ci:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- '.github/workflows/*.yml'
|
||||
|
7
.github/labeler_merged.yml
vendored
7
.github/labeler_merged.yml
vendored
@ -1,3 +1,8 @@
|
||||
# Add 'needs changelog` label to any change to code files as long as the `CHANGELOG` hasn't changed
|
||||
# Skip dependabot and pre-commit-ci PRs
|
||||
needs changelog:
|
||||
- all:
|
||||
- '!docs/changelog.rst'
|
||||
- changed-files:
|
||||
- all-globs-to-all-files: "!docs/changelog.rst"
|
||||
- base-branch: "^(?!dependabot).*"
|
||||
- base-branch: "^(?!pre-commit-ci).*"
|
||||
|
45
.github/workflows/ci.yml
vendored
45
.github/workflows/ci.yml
vendored
@ -30,13 +30,12 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
runs-on: [ubuntu-20.04, windows-2022, macos-latest]
|
||||
runs-on: [ubuntu-20.04, windows-2022, macos-13]
|
||||
python:
|
||||
- '3.6'
|
||||
- '3.9'
|
||||
- '3.10'
|
||||
- '3.11'
|
||||
- '3.12'
|
||||
- '3.13'
|
||||
- 'pypy-3.8'
|
||||
- 'pypy-3.9'
|
||||
- 'pypy-3.10'
|
||||
@ -64,6 +63,10 @@ jobs:
|
||||
# Inject a couple Windows 2019 runs
|
||||
- runs-on: windows-2019
|
||||
python: '3.9'
|
||||
# Extra ubuntu latest job
|
||||
- runs-on: ubuntu-latest
|
||||
python: '3.11'
|
||||
|
||||
|
||||
name: "🐍 ${{ matrix.python }} • ${{ matrix.runs-on }} • x64 ${{ matrix.args }}"
|
||||
runs-on: ${{ matrix.runs-on }}
|
||||
@ -75,6 +78,7 @@ jobs:
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
allow-prereleases: true
|
||||
|
||||
- name: Setup Boost (Linux)
|
||||
# Can't use boost + define _
|
||||
@ -192,6 +196,35 @@ jobs:
|
||||
pytest tests/extra_setuptools
|
||||
if: "!(matrix.runs-on == 'windows-2022')"
|
||||
|
||||
manylinux:
|
||||
name: Manylinux on 🐍 3.13t • GIL
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 40
|
||||
container: quay.io/pypa/musllinux_1_2_x86_64:latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Prepare venv
|
||||
run: python3.13t -m venv .venv
|
||||
|
||||
- name: Install Python deps
|
||||
run: .venv/bin/pip install -r tests/requirements.txt
|
||||
|
||||
- name: Configure C++11
|
||||
run: >
|
||||
cmake -S. -Bbuild
|
||||
-DPYBIND11_WERROR=ON
|
||||
-DDOWNLOAD_CATCH=ON
|
||||
-DDOWNLOAD_EIGEN=ON
|
||||
-DPython_ROOT_DIR=.venv
|
||||
|
||||
- name: Build C++11
|
||||
run: cmake --build build -j2
|
||||
|
||||
- name: Python tests C++11
|
||||
run: cmake --build build --target pytest -j2
|
||||
|
||||
deadsnakes:
|
||||
strategy:
|
||||
@ -972,7 +1005,6 @@ jobs:
|
||||
mingw-w64-${{matrix.env}}-cmake
|
||||
mingw-w64-${{matrix.env}}-make
|
||||
mingw-w64-${{matrix.env}}-python-pytest
|
||||
mingw-w64-${{matrix.env}}-eigen3
|
||||
mingw-w64-${{matrix.env}}-boost
|
||||
mingw-w64-${{matrix.env}}-catch
|
||||
|
||||
@ -983,6 +1015,7 @@ jobs:
|
||||
install: >-
|
||||
git
|
||||
mingw-w64-${{matrix.env}}-python-scipy
|
||||
mingw-w64-${{matrix.env}}-eigen3
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@ -1118,8 +1151,8 @@ jobs:
|
||||
run: git clean -fdx
|
||||
|
||||
macos_brew_install_llvm:
|
||||
name: "macos-latest • brew install llvm"
|
||||
runs-on: macos-latest
|
||||
name: "macos-13 • brew install llvm"
|
||||
runs-on: macos-13
|
||||
|
||||
env:
|
||||
# https://apple.stackexchange.com/questions/227026/how-to-install-recent-clang-with-homebrew
|
||||
|
4
.github/workflows/configure.yml
vendored
4
.github/workflows/configure.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
runs-on: [ubuntu-20.04, macos-latest, windows-latest]
|
||||
runs-on: [ubuntu-20.04, macos-13, windows-latest]
|
||||
arch: [x64]
|
||||
cmake: ["3.26"]
|
||||
|
||||
@ -37,7 +37,7 @@ jobs:
|
||||
arch: x64
|
||||
cmake: "3.29"
|
||||
|
||||
- runs-on: macos-latest
|
||||
- runs-on: macos-13
|
||||
arch: x64
|
||||
cmake: "3.7"
|
||||
|
||||
|
2
.github/workflows/labeler.yml
vendored
2
.github/workflows/labeler.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
||||
pull-requests: write
|
||||
steps:
|
||||
|
||||
- uses: actions/labeler@v4
|
||||
- uses: actions/labeler@v5
|
||||
if: >
|
||||
github.event.pull_request.merged == true &&
|
||||
!startsWith(github.event.pull_request.title, 'chore(deps):') &&
|
||||
|
@ -25,14 +25,14 @@ repos:
|
||||
|
||||
# Clang format the codebase automatically
|
||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||
rev: "v18.1.2"
|
||||
rev: "v18.1.5"
|
||||
hooks:
|
||||
- id: clang-format
|
||||
types_or: [c++, c, cuda]
|
||||
|
||||
# Ruff, the Python auto-correcting linter/formatter written in Rust
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.3.5
|
||||
rev: v0.4.7
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: ["--fix", "--show-fixes"]
|
||||
@ -40,7 +40,7 @@ repos:
|
||||
|
||||
# Check static types with mypy
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: "v1.9.0"
|
||||
rev: "v1.10.0"
|
||||
hooks:
|
||||
- id: mypy
|
||||
args: []
|
||||
@ -62,7 +62,7 @@ repos:
|
||||
|
||||
# Standard hooks
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: "v4.5.0"
|
||||
rev: "v4.6.0"
|
||||
hooks:
|
||||
- id: check-added-large-files
|
||||
- id: check-case-conflict
|
||||
@ -78,7 +78,7 @@ repos:
|
||||
- id: trailing-whitespace
|
||||
|
||||
# Also code format the docs
|
||||
- repo: https://github.com/asottile/blacken-docs
|
||||
- repo: https://github.com/adamchainz/blacken-docs
|
||||
rev: "1.16.0"
|
||||
hooks:
|
||||
- id: blacken-docs
|
||||
@ -119,11 +119,11 @@ repos:
|
||||
# Use tools/codespell_ignore_lines_from_errors.py
|
||||
# to rebuild .codespell-ignore-lines
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: "v2.2.6"
|
||||
rev: "v2.3.0"
|
||||
hooks:
|
||||
- id: codespell
|
||||
exclude: ".supp$"
|
||||
args: ["-x.codespell-ignore-lines", "-Lccompiler"]
|
||||
args: ["-x.codespell-ignore-lines", "-Lccompiler,intstruct"]
|
||||
|
||||
# Check for common shell mistakes
|
||||
- repo: https://github.com/shellcheck-py/shellcheck-py
|
||||
@ -142,13 +142,14 @@ repos:
|
||||
|
||||
# PyLint has native support - not always usable, but works for us
|
||||
- repo: https://github.com/PyCQA/pylint
|
||||
rev: "v3.1.0"
|
||||
rev: "v3.2.2"
|
||||
hooks:
|
||||
- id: pylint
|
||||
files: ^pybind11
|
||||
|
||||
# Check schemas on some of our YAML files
|
||||
- repo: https://github.com/python-jsonschema/check-jsonschema
|
||||
rev: 0.28.1
|
||||
rev: 0.28.4
|
||||
hooks:
|
||||
- id: check-readthedocs
|
||||
- id: check-github-workflows
|
||||
|
@ -116,6 +116,7 @@ option(PYBIND11_NUMPY_1_ONLY
|
||||
set(PYBIND11_INTERNALS_VERSION
|
||||
""
|
||||
CACHE STRING "Override the ABI version, may be used to enable the unstable ABI.")
|
||||
option(PYBIND11_USE_CROSSCOMPILING "Respect CMAKE_CROSSCOMPILING" OFF)
|
||||
|
||||
if(PYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION)
|
||||
add_compile_definitions(PYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION)
|
||||
@ -299,6 +300,7 @@ if(PYBIND11_INSTALL)
|
||||
tools/pybind11Common.cmake
|
||||
tools/pybind11Tools.cmake
|
||||
tools/pybind11NewTools.cmake
|
||||
tools/pybind11GuessPythonExtSuffix.cmake
|
||||
DESTINATION ${PYBIND11_CMAKECONFIG_INSTALL_DIR})
|
||||
|
||||
if(NOT PYBIND11_EXPORT_NAME)
|
||||
|
@ -378,8 +378,6 @@ uses of ``py::array``:
|
||||
|
||||
- ``.itemsize()`` returns the size of an item in bytes, i.e. ``sizeof(T)``.
|
||||
|
||||
- ``.ndim()`` returns the number of dimensions.
|
||||
|
||||
- ``.shape(n)`` returns the size of dimension ``n``
|
||||
|
||||
- ``.size()`` returns the total number of elements (i.e. the product of the shapes).
|
||||
|
@ -15,7 +15,7 @@ IN DEVELOPMENT
|
||||
|
||||
Changes will be summarized here periodically.
|
||||
|
||||
Version 2.12.0 (March 27, 2025)
|
||||
Version 2.12.0 (March 27, 2024)
|
||||
-------------------------------
|
||||
|
||||
New Features:
|
||||
|
@ -81,7 +81,7 @@ version = loc["__version__"]
|
||||
#
|
||||
# This is also used if you do content translation via gettext catalogs.
|
||||
# Usually you set "language" from the command line for these cases.
|
||||
language = None
|
||||
language = "en"
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
|
6
docs/requirements.in
Normal file
6
docs/requirements.in
Normal file
@ -0,0 +1,6 @@
|
||||
breathe
|
||||
furo
|
||||
sphinx
|
||||
sphinx-copybutton
|
||||
sphinxcontrib-moderncmakedomain
|
||||
sphinxcontrib-svg2pdfconverter
|
@ -1,6 +1,275 @@
|
||||
breathe==4.34.0
|
||||
furo==2022.6.21
|
||||
sphinx==5.0.2
|
||||
sphinx-copybutton==0.5.0
|
||||
sphinxcontrib-moderncmakedomain==3.21.4
|
||||
sphinxcontrib-svg2pdfconverter==1.2.0
|
||||
# This file was autogenerated by uv via the following command:
|
||||
# uv pip compile --generate-hashes docs/requirements.in -o docs/requirements.txt
|
||||
alabaster==0.7.16 \
|
||||
--hash=sha256:75a8b99c28a5dad50dd7f8ccdd447a121ddb3892da9e53d1ca5cca3106d58d65 \
|
||||
--hash=sha256:b46733c07dce03ae4e150330b975c75737fa60f0a7c591b6c8bf4928a28e2c92
|
||||
# via sphinx
|
||||
babel==2.14.0 \
|
||||
--hash=sha256:6919867db036398ba21eb5c7a0f6b28ab8cbc3ae7a73a44ebe34ae74a4e7d363 \
|
||||
--hash=sha256:efb1a25b7118e67ce3a259bed20545c29cb68be8ad2c784c83689981b7a57287
|
||||
# via sphinx
|
||||
beautifulsoup4==4.12.3 \
|
||||
--hash=sha256:74e3d1928edc070d21748185c46e3fb33490f22f52a3addee9aee0f4f7781051 \
|
||||
--hash=sha256:b80878c9f40111313e55da8ba20bdba06d8fa3969fc68304167741bbf9e082ed
|
||||
# via furo
|
||||
breathe==4.35.0 \
|
||||
--hash=sha256:5165541c3c67b6c7adde8b3ecfe895c6f7844783c4076b6d8d287e4f33d62386 \
|
||||
--hash=sha256:52c581f42ca4310737f9e435e3851c3d1f15446205a85fbc272f1f97ed74f5be
|
||||
# via -r requirements.in
|
||||
certifi==2024.2.2 \
|
||||
--hash=sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f \
|
||||
--hash=sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1
|
||||
# via requests
|
||||
charset-normalizer==3.3.2 \
|
||||
--hash=sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027 \
|
||||
--hash=sha256:06a81e93cd441c56a9b65d8e1d043daeb97a3d0856d177d5c90ba85acb3db087 \
|
||||
--hash=sha256:0a55554a2fa0d408816b3b5cedf0045f4b8e1a6065aec45849de2d6f3f8e9786 \
|
||||
--hash=sha256:0b2b64d2bb6d3fb9112bafa732def486049e63de9618b5843bcdd081d8144cd8 \
|
||||
--hash=sha256:10955842570876604d404661fbccbc9c7e684caf432c09c715ec38fbae45ae09 \
|
||||
--hash=sha256:122c7fa62b130ed55f8f285bfd56d5f4b4a5b503609d181f9ad85e55c89f4185 \
|
||||
--hash=sha256:1ceae2f17a9c33cb48e3263960dc5fc8005351ee19db217e9b1bb15d28c02574 \
|
||||
--hash=sha256:1d3193f4a680c64b4b6a9115943538edb896edc190f0b222e73761716519268e \
|
||||
--hash=sha256:1f79682fbe303db92bc2b1136016a38a42e835d932bab5b3b1bfcfbf0640e519 \
|
||||
--hash=sha256:2127566c664442652f024c837091890cb1942c30937add288223dc895793f898 \
|
||||
--hash=sha256:22afcb9f253dac0696b5a4be4a1c0f8762f8239e21b99680099abd9b2b1b2269 \
|
||||
--hash=sha256:25baf083bf6f6b341f4121c2f3c548875ee6f5339300e08be3f2b2ba1721cdd3 \
|
||||
--hash=sha256:2e81c7b9c8979ce92ed306c249d46894776a909505d8f5a4ba55b14206e3222f \
|
||||
--hash=sha256:3287761bc4ee9e33561a7e058c72ac0938c4f57fe49a09eae428fd88aafe7bb6 \
|
||||
--hash=sha256:34d1c8da1e78d2e001f363791c98a272bb734000fcef47a491c1e3b0505657a8 \
|
||||
--hash=sha256:37e55c8e51c236f95b033f6fb391d7d7970ba5fe7ff453dad675e88cf303377a \
|
||||
--hash=sha256:3d47fa203a7bd9c5b6cee4736ee84ca03b8ef23193c0d1ca99b5089f72645c73 \
|
||||
--hash=sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc \
|
||||
--hash=sha256:42cb296636fcc8b0644486d15c12376cb9fa75443e00fb25de0b8602e64c1714 \
|
||||
--hash=sha256:45485e01ff4d3630ec0d9617310448a8702f70e9c01906b0d0118bdf9d124cf2 \
|
||||
--hash=sha256:4a78b2b446bd7c934f5dcedc588903fb2f5eec172f3d29e52a9096a43722adfc \
|
||||
--hash=sha256:4ab2fe47fae9e0f9dee8c04187ce5d09f48eabe611be8259444906793ab7cbce \
|
||||
--hash=sha256:4d0d1650369165a14e14e1e47b372cfcb31d6ab44e6e33cb2d4e57265290044d \
|
||||
--hash=sha256:549a3a73da901d5bc3ce8d24e0600d1fa85524c10287f6004fbab87672bf3e1e \
|
||||
--hash=sha256:55086ee1064215781fff39a1af09518bc9255b50d6333f2e4c74ca09fac6a8f6 \
|
||||
--hash=sha256:572c3763a264ba47b3cf708a44ce965d98555f618ca42c926a9c1616d8f34269 \
|
||||
--hash=sha256:573f6eac48f4769d667c4442081b1794f52919e7edada77495aaed9236d13a96 \
|
||||
--hash=sha256:5b4c145409bef602a690e7cfad0a15a55c13320ff7a3ad7ca59c13bb8ba4d45d \
|
||||
--hash=sha256:6463effa3186ea09411d50efc7d85360b38d5f09b870c48e4600f63af490e56a \
|
||||
--hash=sha256:65f6f63034100ead094b8744b3b97965785388f308a64cf8d7c34f2f2e5be0c4 \
|
||||
--hash=sha256:663946639d296df6a2bb2aa51b60a2454ca1cb29835324c640dafb5ff2131a77 \
|
||||
--hash=sha256:6897af51655e3691ff853668779c7bad41579facacf5fd7253b0133308cf000d \
|
||||
--hash=sha256:68d1f8a9e9e37c1223b656399be5d6b448dea850bed7d0f87a8311f1ff3dabb0 \
|
||||
--hash=sha256:6ac7ffc7ad6d040517be39eb591cac5ff87416c2537df6ba3cba3bae290c0fed \
|
||||
--hash=sha256:6b3251890fff30ee142c44144871185dbe13b11bab478a88887a639655be1068 \
|
||||
--hash=sha256:6c4caeef8fa63d06bd437cd4bdcf3ffefe6738fb1b25951440d80dc7df8c03ac \
|
||||
--hash=sha256:6ef1d82a3af9d3eecdba2321dc1b3c238245d890843e040e41e470ffa64c3e25 \
|
||||
--hash=sha256:753f10e867343b4511128c6ed8c82f7bec3bd026875576dfd88483c5c73b2fd8 \
|
||||
--hash=sha256:7cd13a2e3ddeed6913a65e66e94b51d80a041145a026c27e6bb76c31a853c6ab \
|
||||
--hash=sha256:7ed9e526742851e8d5cc9e6cf41427dfc6068d4f5a3bb03659444b4cabf6bc26 \
|
||||
--hash=sha256:7f04c839ed0b6b98b1a7501a002144b76c18fb1c1850c8b98d458ac269e26ed2 \
|
||||
--hash=sha256:802fe99cca7457642125a8a88a084cef28ff0cf9407060f7b93dca5aa25480db \
|
||||
--hash=sha256:80402cd6ee291dcb72644d6eac93785fe2c8b9cb30893c1af5b8fdd753b9d40f \
|
||||
--hash=sha256:8465322196c8b4d7ab6d1e049e4c5cb460d0394da4a27d23cc242fbf0034b6b5 \
|
||||
--hash=sha256:86216b5cee4b06df986d214f664305142d9c76df9b6512be2738aa72a2048f99 \
|
||||
--hash=sha256:87d1351268731db79e0f8e745d92493ee2841c974128ef629dc518b937d9194c \
|
||||
--hash=sha256:8bdb58ff7ba23002a4c5808d608e4e6c687175724f54a5dade5fa8c67b604e4d \
|
||||
--hash=sha256:8c622a5fe39a48f78944a87d4fb8a53ee07344641b0562c540d840748571b811 \
|
||||
--hash=sha256:8d756e44e94489e49571086ef83b2bb8ce311e730092d2c34ca8f7d925cb20aa \
|
||||
--hash=sha256:8f4a014bc36d3c57402e2977dada34f9c12300af536839dc38c0beab8878f38a \
|
||||
--hash=sha256:9063e24fdb1e498ab71cb7419e24622516c4a04476b17a2dab57e8baa30d6e03 \
|
||||
--hash=sha256:90d558489962fd4918143277a773316e56c72da56ec7aa3dc3dbbe20fdfed15b \
|
||||
--hash=sha256:923c0c831b7cfcb071580d3f46c4baf50f174be571576556269530f4bbd79d04 \
|
||||
--hash=sha256:95f2a5796329323b8f0512e09dbb7a1860c46a39da62ecb2324f116fa8fdc85c \
|
||||
--hash=sha256:96b02a3dc4381e5494fad39be677abcb5e6634bf7b4fa83a6dd3112607547001 \
|
||||
--hash=sha256:9f96df6923e21816da7e0ad3fd47dd8f94b2a5ce594e00677c0013018b813458 \
|
||||
--hash=sha256:a10af20b82360ab00827f916a6058451b723b4e65030c5a18577c8b2de5b3389 \
|
||||
--hash=sha256:a50aebfa173e157099939b17f18600f72f84eed3049e743b68ad15bd69b6bf99 \
|
||||
--hash=sha256:a981a536974bbc7a512cf44ed14938cf01030a99e9b3a06dd59578882f06f985 \
|
||||
--hash=sha256:a9a8e9031d613fd2009c182b69c7b2c1ef8239a0efb1df3f7c8da66d5dd3d537 \
|
||||
--hash=sha256:ae5f4161f18c61806f411a13b0310bea87f987c7d2ecdbdaad0e94eb2e404238 \
|
||||
--hash=sha256:aed38f6e4fb3f5d6bf81bfa990a07806be9d83cf7bacef998ab1a9bd660a581f \
|
||||
--hash=sha256:b01b88d45a6fcb69667cd6d2f7a9aeb4bf53760d7fc536bf679ec94fe9f3ff3d \
|
||||
--hash=sha256:b261ccdec7821281dade748d088bb6e9b69e6d15b30652b74cbbac25e280b796 \
|
||||
--hash=sha256:b2b0a0c0517616b6869869f8c581d4eb2dd83a4d79e0ebcb7d373ef9956aeb0a \
|
||||
--hash=sha256:b4a23f61ce87adf89be746c8a8974fe1c823c891d8f86eb218bb957c924bb143 \
|
||||
--hash=sha256:bd8f7df7d12c2db9fab40bdd87a7c09b1530128315d047a086fa3ae3435cb3a8 \
|
||||
--hash=sha256:beb58fe5cdb101e3a055192ac291b7a21e3b7ef4f67fa1d74e331a7f2124341c \
|
||||
--hash=sha256:c002b4ffc0be611f0d9da932eb0f704fe2602a9a949d1f738e4c34c75b0863d5 \
|
||||
--hash=sha256:c083af607d2515612056a31f0a8d9e0fcb5876b7bfc0abad3ecd275bc4ebc2d5 \
|
||||
--hash=sha256:c180f51afb394e165eafe4ac2936a14bee3eb10debc9d9e4db8958fe36afe711 \
|
||||
--hash=sha256:c235ebd9baae02f1b77bcea61bce332cb4331dc3617d254df3323aa01ab47bd4 \
|
||||
--hash=sha256:cd70574b12bb8a4d2aaa0094515df2463cb429d8536cfb6c7ce983246983e5a6 \
|
||||
--hash=sha256:d0eccceffcb53201b5bfebb52600a5fb483a20b61da9dbc885f8b103cbe7598c \
|
||||
--hash=sha256:d965bba47ddeec8cd560687584e88cf699fd28f192ceb452d1d7ee807c5597b7 \
|
||||
--hash=sha256:db364eca23f876da6f9e16c9da0df51aa4f104a972735574842618b8c6d999d4 \
|
||||
--hash=sha256:ddbb2551d7e0102e7252db79ba445cdab71b26640817ab1e3e3648dad515003b \
|
||||
--hash=sha256:deb6be0ac38ece9ba87dea880e438f25ca3eddfac8b002a2ec3d9183a454e8ae \
|
||||
--hash=sha256:e06ed3eb3218bc64786f7db41917d4e686cc4856944f53d5bdf83a6884432e12 \
|
||||
--hash=sha256:e27ad930a842b4c5eb8ac0016b0a54f5aebbe679340c26101df33424142c143c \
|
||||
--hash=sha256:e537484df0d8f426ce2afb2d0f8e1c3d0b114b83f8850e5f2fbea0e797bd82ae \
|
||||
--hash=sha256:eb00ed941194665c332bf8e078baf037d6c35d7c4f3102ea2d4f16ca94a26dc8 \
|
||||
--hash=sha256:eb6904c354526e758fda7167b33005998fb68c46fbc10e013ca97f21ca5c8887 \
|
||||
--hash=sha256:eb8821e09e916165e160797a6c17edda0679379a4be5c716c260e836e122f54b \
|
||||
--hash=sha256:efcb3f6676480691518c177e3b465bcddf57cea040302f9f4e6e191af91174d4 \
|
||||
--hash=sha256:f27273b60488abe721a075bcca6d7f3964f9f6f067c8c4c605743023d7d3944f \
|
||||
--hash=sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5 \
|
||||
--hash=sha256:fb69256e180cb6c8a894fee62b3afebae785babc1ee98b81cdf68bbca1987f33 \
|
||||
--hash=sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519 \
|
||||
--hash=sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561
|
||||
# via requests
|
||||
docutils==0.20.1 \
|
||||
--hash=sha256:96f387a2c5562db4476f09f13bbab2192e764cac08ebbf3a34a95d9b1e4a59d6 \
|
||||
--hash=sha256:f08a4e276c3a1583a86dce3e34aba3fe04d02bba2dd51ed16106244e8a923e3b
|
||||
# via
|
||||
# breathe
|
||||
# sphinx
|
||||
furo==2024.1.29 \
|
||||
--hash=sha256:3548be2cef45a32f8cdc0272d415fcb3e5fa6a0eb4ddfe21df3ecf1fe45a13cf \
|
||||
--hash=sha256:4d6b2fe3f10a6e36eb9cc24c1e7beb38d7a23fc7b3c382867503b7fcac8a1e02
|
||||
# via -r requirements.in
|
||||
idna==3.7 \
|
||||
--hash=sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc \
|
||||
--hash=sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0
|
||||
# via requests
|
||||
imagesize==1.4.1 \
|
||||
--hash=sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b \
|
||||
--hash=sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a
|
||||
# via sphinx
|
||||
jinja2==3.1.4 \
|
||||
--hash=sha256:4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369 \
|
||||
--hash=sha256:bc5dd2abb727a5319567b7a813e6a2e7318c39f4f487cfe6c89c6f9c7d25197d
|
||||
# via sphinx
|
||||
markupsafe==2.1.5 \
|
||||
--hash=sha256:00e046b6dd71aa03a41079792f8473dc494d564611a8f89bbbd7cb93295ebdcf \
|
||||
--hash=sha256:075202fa5b72c86ad32dc7d0b56024ebdbcf2048c0ba09f1cde31bfdd57bcfff \
|
||||
--hash=sha256:0e397ac966fdf721b2c528cf028494e86172b4feba51d65f81ffd65c63798f3f \
|
||||
--hash=sha256:17b950fccb810b3293638215058e432159d2b71005c74371d784862b7e4683f3 \
|
||||
--hash=sha256:1f3fbcb7ef1f16e48246f704ab79d79da8a46891e2da03f8783a5b6fa41a9532 \
|
||||
--hash=sha256:2174c595a0d73a3080ca3257b40096db99799265e1c27cc5a610743acd86d62f \
|
||||
--hash=sha256:2b7c57a4dfc4f16f7142221afe5ba4e093e09e728ca65c51f5620c9aaeb9a617 \
|
||||
--hash=sha256:2d2d793e36e230fd32babe143b04cec8a8b3eb8a3122d2aceb4a371e6b09b8df \
|
||||
--hash=sha256:30b600cf0a7ac9234b2638fbc0fb6158ba5bdcdf46aeb631ead21248b9affbc4 \
|
||||
--hash=sha256:397081c1a0bfb5124355710fe79478cdbeb39626492b15d399526ae53422b906 \
|
||||
--hash=sha256:3a57fdd7ce31c7ff06cdfbf31dafa96cc533c21e443d57f5b1ecc6cdc668ec7f \
|
||||
--hash=sha256:3c6b973f22eb18a789b1460b4b91bf04ae3f0c4234a0a6aa6b0a92f6f7b951d4 \
|
||||
--hash=sha256:3e53af139f8579a6d5f7b76549125f0d94d7e630761a2111bc431fd820e163b8 \
|
||||
--hash=sha256:4096e9de5c6fdf43fb4f04c26fb114f61ef0bf2e5604b6ee3019d51b69e8c371 \
|
||||
--hash=sha256:4275d846e41ecefa46e2015117a9f491e57a71ddd59bbead77e904dc02b1bed2 \
|
||||
--hash=sha256:4c31f53cdae6ecfa91a77820e8b151dba54ab528ba65dfd235c80b086d68a465 \
|
||||
--hash=sha256:4f11aa001c540f62c6166c7726f71f7573b52c68c31f014c25cc7901deea0b52 \
|
||||
--hash=sha256:5049256f536511ee3f7e1b3f87d1d1209d327e818e6ae1365e8653d7e3abb6a6 \
|
||||
--hash=sha256:58c98fee265677f63a4385256a6d7683ab1832f3ddd1e66fe948d5880c21a169 \
|
||||
--hash=sha256:598e3276b64aff0e7b3451b72e94fa3c238d452e7ddcd893c3ab324717456bad \
|
||||
--hash=sha256:5b7b716f97b52c5a14bffdf688f971b2d5ef4029127f1ad7a513973cfd818df2 \
|
||||
--hash=sha256:5dedb4db619ba5a2787a94d877bc8ffc0566f92a01c0ef214865e54ecc9ee5e0 \
|
||||
--hash=sha256:619bc166c4f2de5caa5a633b8b7326fbe98e0ccbfacabd87268a2b15ff73a029 \
|
||||
--hash=sha256:629ddd2ca402ae6dbedfceeba9c46d5f7b2a61d9749597d4307f943ef198fc1f \
|
||||
--hash=sha256:656f7526c69fac7f600bd1f400991cc282b417d17539a1b228617081106feb4a \
|
||||
--hash=sha256:6ec585f69cec0aa07d945b20805be741395e28ac1627333b1c5b0105962ffced \
|
||||
--hash=sha256:72b6be590cc35924b02c78ef34b467da4ba07e4e0f0454a2c5907f473fc50ce5 \
|
||||
--hash=sha256:7502934a33b54030eaf1194c21c692a534196063db72176b0c4028e140f8f32c \
|
||||
--hash=sha256:7a68b554d356a91cce1236aa7682dc01df0edba8d043fd1ce607c49dd3c1edcf \
|
||||
--hash=sha256:7b2e5a267c855eea6b4283940daa6e88a285f5f2a67f2220203786dfa59b37e9 \
|
||||
--hash=sha256:823b65d8706e32ad2df51ed89496147a42a2a6e01c13cfb6ffb8b1e92bc910bb \
|
||||
--hash=sha256:8590b4ae07a35970728874632fed7bd57b26b0102df2d2b233b6d9d82f6c62ad \
|
||||
--hash=sha256:8dd717634f5a044f860435c1d8c16a270ddf0ef8588d4887037c5028b859b0c3 \
|
||||
--hash=sha256:8dec4936e9c3100156f8a2dc89c4b88d5c435175ff03413b443469c7c8c5f4d1 \
|
||||
--hash=sha256:97cafb1f3cbcd3fd2b6fbfb99ae11cdb14deea0736fc2b0952ee177f2b813a46 \
|
||||
--hash=sha256:a17a92de5231666cfbe003f0e4b9b3a7ae3afb1ec2845aadc2bacc93ff85febc \
|
||||
--hash=sha256:a549b9c31bec33820e885335b451286e2969a2d9e24879f83fe904a5ce59d70a \
|
||||
--hash=sha256:ac07bad82163452a6884fe8fa0963fb98c2346ba78d779ec06bd7a6262132aee \
|
||||
--hash=sha256:ae2ad8ae6ebee9d2d94b17fb62763125f3f374c25618198f40cbb8b525411900 \
|
||||
--hash=sha256:b91c037585eba9095565a3556f611e3cbfaa42ca1e865f7b8015fe5c7336d5a5 \
|
||||
--hash=sha256:bc1667f8b83f48511b94671e0e441401371dfd0f0a795c7daa4a3cd1dde55bea \
|
||||
--hash=sha256:bec0a414d016ac1a18862a519e54b2fd0fc8bbfd6890376898a6c0891dd82e9f \
|
||||
--hash=sha256:bf50cd79a75d181c9181df03572cdce0fbb75cc353bc350712073108cba98de5 \
|
||||
--hash=sha256:bff1b4290a66b490a2f4719358c0cdcd9bafb6b8f061e45c7a2460866bf50c2e \
|
||||
--hash=sha256:c061bb86a71b42465156a3ee7bd58c8c2ceacdbeb95d05a99893e08b8467359a \
|
||||
--hash=sha256:c8b29db45f8fe46ad280a7294f5c3ec36dbac9491f2d1c17345be8e69cc5928f \
|
||||
--hash=sha256:ce409136744f6521e39fd8e2a24c53fa18ad67aa5bc7c2cf83645cce5b5c4e50 \
|
||||
--hash=sha256:d050b3361367a06d752db6ead6e7edeb0009be66bc3bae0ee9d97fb326badc2a \
|
||||
--hash=sha256:d283d37a890ba4c1ae73ffadf8046435c76e7bc2247bbb63c00bd1a709c6544b \
|
||||
--hash=sha256:d9fad5155d72433c921b782e58892377c44bd6252b5af2f67f16b194987338a4 \
|
||||
--hash=sha256:daa4ee5a243f0f20d528d939d06670a298dd39b1ad5f8a72a4275124a7819eff \
|
||||
--hash=sha256:db0b55e0f3cc0be60c1f19efdde9a637c32740486004f20d1cff53c3c0ece4d2 \
|
||||
--hash=sha256:e61659ba32cf2cf1481e575d0462554625196a1f2fc06a1c777d3f48e8865d46 \
|
||||
--hash=sha256:ea3d8a3d18833cf4304cd2fc9cbb1efe188ca9b5efef2bdac7adc20594a0e46b \
|
||||
--hash=sha256:ec6a563cff360b50eed26f13adc43e61bc0c04d94b8be985e6fb24b81f6dcfdf \
|
||||
--hash=sha256:f5dfb42c4604dddc8e4305050aa6deb084540643ed5804d7455b5df8fe16f5e5 \
|
||||
--hash=sha256:fa173ec60341d6bb97a89f5ea19c85c5643c1e7dedebc22f5181eb73573142c5 \
|
||||
--hash=sha256:fa9db3f79de01457b03d4f01b34cf91bc0048eb2c3846ff26f66687c2f6d16ab \
|
||||
--hash=sha256:fce659a462a1be54d2ffcacea5e3ba2d74daa74f30f5f143fe0c58636e355fdd \
|
||||
--hash=sha256:ffee1f21e5ef0d712f9033568f8344d5da8cc2869dbd08d87c84656e6a2d2f68
|
||||
# via jinja2
|
||||
packaging==24.0 \
|
||||
--hash=sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5 \
|
||||
--hash=sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9
|
||||
# via sphinx
|
||||
pygments==2.17.2 \
|
||||
--hash=sha256:b27c2826c47d0f3219f29554824c30c5e8945175d888647acd804ddd04af846c \
|
||||
--hash=sha256:da46cec9fd2de5be3a8a784f434e4c4ab670b4ff54d605c4c2717e9d49c4c367
|
||||
# via
|
||||
# furo
|
||||
# sphinx
|
||||
requests==2.32.0 \
|
||||
--hash=sha256:f2c3881dddb70d056c5bd7600a4fae312b2a300e39be6a118d30b90bd27262b5 \
|
||||
--hash=sha256:fa5490319474c82ef1d2c9bc459d3652e3ae4ef4c4ebdd18a21145a47ca4b6b8
|
||||
# via sphinx
|
||||
snowballstemmer==2.2.0 \
|
||||
--hash=sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1 \
|
||||
--hash=sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a
|
||||
# via sphinx
|
||||
soupsieve==2.5 \
|
||||
--hash=sha256:5663d5a7b3bfaeee0bc4372e7fc48f9cff4940b3eec54a6451cc5299f1097690 \
|
||||
--hash=sha256:eaa337ff55a1579b6549dc679565eac1e3d000563bcb1c8ab0d0fefbc0c2cdc7
|
||||
# via beautifulsoup4
|
||||
sphinx==7.2.6 \
|
||||
--hash=sha256:1e09160a40b956dc623c910118fa636da93bd3ca0b9876a7b3df90f07d691560 \
|
||||
--hash=sha256:9a5160e1ea90688d5963ba09a2dcd8bdd526620edbb65c328728f1b2228d5ab5
|
||||
# via
|
||||
# -r requirements.in
|
||||
# breathe
|
||||
# furo
|
||||
# sphinx-basic-ng
|
||||
# sphinx-copybutton
|
||||
# sphinxcontrib-moderncmakedomain
|
||||
# sphinxcontrib-svg2pdfconverter
|
||||
sphinx-basic-ng==1.0.0b2 \
|
||||
--hash=sha256:9ec55a47c90c8c002b5960c57492ec3021f5193cb26cebc2dc4ea226848651c9 \
|
||||
--hash=sha256:eb09aedbabfb650607e9b4b68c9d240b90b1e1be221d6ad71d61c52e29f7932b
|
||||
# via furo
|
||||
sphinx-copybutton==0.5.2 \
|
||||
--hash=sha256:4cf17c82fb9646d1bc9ca92ac280813a3b605d8c421225fd9913154103ee1fbd \
|
||||
--hash=sha256:fb543fd386d917746c9a2c50360c7905b605726b9355cd26e9974857afeae06e
|
||||
# via -r requirements.in
|
||||
sphinxcontrib-applehelp==1.0.8 \
|
||||
--hash=sha256:c40a4f96f3776c4393d933412053962fac2b84f4c99a7982ba42e09576a70619 \
|
||||
--hash=sha256:cb61eb0ec1b61f349e5cc36b2028e9e7ca765be05e49641c97241274753067b4
|
||||
# via sphinx
|
||||
sphinxcontrib-devhelp==1.0.6 \
|
||||
--hash=sha256:6485d09629944511c893fa11355bda18b742b83a2b181f9a009f7e500595c90f \
|
||||
--hash=sha256:9893fd3f90506bc4b97bdb977ceb8fbd823989f4316b28c3841ec128544372d3
|
||||
# via sphinx
|
||||
sphinxcontrib-htmlhelp==2.0.5 \
|
||||
--hash=sha256:0dc87637d5de53dd5eec3a6a01753b1ccf99494bd756aafecd74b4fa9e729015 \
|
||||
--hash=sha256:393f04f112b4d2f53d93448d4bce35842f62b307ccdc549ec1585e950bc35e04
|
||||
# via sphinx
|
||||
sphinxcontrib-jsmath==1.0.1 \
|
||||
--hash=sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178 \
|
||||
--hash=sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8
|
||||
# via sphinx
|
||||
sphinxcontrib-moderncmakedomain==3.27.0 \
|
||||
--hash=sha256:51e259e91f58d17cc0fac9307fd40106aa59d5acaa741887903fc3660361d1a1 \
|
||||
--hash=sha256:70a73e0e7cff1b117074e968ccb7f72383ed0f572414df0e216cea06914de988
|
||||
# via -r requirements.in
|
||||
sphinxcontrib-qthelp==1.0.7 \
|
||||
--hash=sha256:053dedc38823a80a7209a80860b16b722e9e0209e32fea98c90e4e6624588ed6 \
|
||||
--hash=sha256:e2ae3b5c492d58fcbd73281fbd27e34b8393ec34a073c792642cd8e529288182
|
||||
# via sphinx
|
||||
sphinxcontrib-serializinghtml==1.1.10 \
|
||||
--hash=sha256:326369b8df80a7d2d8d7f99aa5ac577f51ea51556ed974e7716cfd4fca3f6cb7 \
|
||||
--hash=sha256:93f3f5dc458b91b192fe10c397e324f262cf163d79f3282c158e8436a2c4511f
|
||||
# via sphinx
|
||||
sphinxcontrib-svg2pdfconverter==1.2.2 \
|
||||
--hash=sha256:04ec767b55780a6b18d89cc1a8ada6d900c6efde9d1683abdb98a49b144465ca \
|
||||
--hash=sha256:80a55ca61f70eae93efc65f3814f2f177c86ba55934a9f6c5022f1778b62146b
|
||||
# via -r requirements.in
|
||||
urllib3==2.2.1 \
|
||||
--hash=sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d \
|
||||
--hash=sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19
|
||||
# via requests
|
||||
|
@ -388,7 +388,11 @@ inline void clear_patients(PyObject *self) {
|
||||
auto *instance = reinterpret_cast<detail::instance *>(self);
|
||||
auto &internals = get_internals();
|
||||
auto pos = internals.patients.find(self);
|
||||
assert(pos != internals.patients.end());
|
||||
|
||||
if (pos == internals.patients.end()) {
|
||||
pybind11_fail("FATAL: Internal consistency check failed: Invalid clear_patients() call.");
|
||||
}
|
||||
|
||||
// Clearing the patients can cause more Python code to run, which
|
||||
// can invalidate the iterator. Extract the vector of patients
|
||||
// from the unordered_map first.
|
||||
|
@ -1344,8 +1344,14 @@ using module = module_;
|
||||
/// Return a dictionary representing the global variables in the current execution frame,
|
||||
/// or ``__main__.__dict__`` if there is no frame (usually when the interpreter is embedded).
|
||||
inline dict globals() {
|
||||
#if PY_VERSION_HEX >= 0x030d0000
|
||||
PyObject *p = PyEval_GetFrameGlobals();
|
||||
return p ? reinterpret_steal<dict>(p)
|
||||
: reinterpret_borrow<dict>(module_::import("__main__").attr("__dict__").ptr());
|
||||
#else
|
||||
PyObject *p = PyEval_GetGlobals();
|
||||
return reinterpret_borrow<dict>(p ? p : module_::import("__main__").attr("__dict__").ptr());
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename... Args, typename = detail::enable_if_t<args_are_all_keyword_or_ds<Args...>()>>
|
||||
@ -2770,7 +2776,12 @@ get_type_override(const void *this_ptr, const type_info *this_type, const char *
|
||||
PyCodeObject *f_code = PyFrame_GetCode(frame);
|
||||
// f_code is guaranteed to not be NULL
|
||||
if ((std::string) str(f_code->co_name) == name && f_code->co_argcount > 0) {
|
||||
# if PY_VERSION_HEX >= 0x030d0000
|
||||
PyObject *locals = PyEval_GetFrameLocals();
|
||||
# else
|
||||
PyObject *locals = PyEval_GetLocals();
|
||||
Py_XINCREF(locals);
|
||||
# endif
|
||||
if (locals != nullptr) {
|
||||
# if PY_VERSION_HEX >= 0x030b0000
|
||||
PyObject *co_varnames = PyCode_GetVarnames(f_code);
|
||||
@ -2780,6 +2791,7 @@ get_type_override(const void *this_ptr, const type_info *this_type, const char *
|
||||
PyObject *self_arg = PyTuple_GET_ITEM(co_varnames, 0);
|
||||
Py_DECREF(co_varnames);
|
||||
PyObject *self_caller = dict_getitem(locals, self_arg);
|
||||
Py_DECREF(locals);
|
||||
if (self_caller == self.ptr()) {
|
||||
Py_DECREF(f_code);
|
||||
Py_DECREF(frame);
|
||||
|
@ -183,7 +183,15 @@ public:
|
||||
str_attr_accessor doc() const;
|
||||
|
||||
/// Return the object's current reference count
|
||||
int ref_count() const { return static_cast<int>(Py_REFCNT(derived().ptr())); }
|
||||
ssize_t ref_count() const {
|
||||
#ifdef PYPY_VERSION
|
||||
// PyPy uses the top few bits for REFCNT_FROM_PYPY & REFCNT_FROM_PYPY_LIGHT
|
||||
// Following pybind11 2.12.1 and older behavior and removing this part
|
||||
return static_cast<ssize_t>(static_cast<int>(Py_REFCNT(derived().ptr())));
|
||||
#else
|
||||
return Py_REFCNT(derived().ptr());
|
||||
#endif
|
||||
}
|
||||
|
||||
// TODO PYBIND11_DEPRECATED(
|
||||
// "Call py::type::handle_of(h) or py::type::of(h) instead of h.get_type()")
|
||||
@ -2175,6 +2183,11 @@ public:
|
||||
throw error_already_set();
|
||||
}
|
||||
}
|
||||
void clear() /* py-non-const */ {
|
||||
if (PyList_SetSlice(m_ptr, 0, PyList_Size(m_ptr), nullptr) == -1) {
|
||||
throw error_already_set();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class args : public tuple {
|
||||
|
58
noxfile.py
58
noxfile.py
@ -1,24 +1,10 @@
|
||||
import os
|
||||
import argparse
|
||||
|
||||
import nox
|
||||
|
||||
nox.needs_version = ">=2022.1.7"
|
||||
nox.needs_version = ">=2024.3.2"
|
||||
nox.options.sessions = ["lint", "tests", "tests_packaging"]
|
||||
|
||||
PYTHON_VERSIONS = [
|
||||
"3.6",
|
||||
"3.7",
|
||||
"3.8",
|
||||
"3.9",
|
||||
"3.10",
|
||||
"3.11",
|
||||
"pypy3.7",
|
||||
"pypy3.8",
|
||||
"pypy3.9",
|
||||
]
|
||||
|
||||
if os.environ.get("CI", None):
|
||||
nox.options.error_on_missing_interpreters = True
|
||||
nox.options.default_venv_backend = "uv|virtualenv"
|
||||
|
||||
|
||||
@nox.session(reuse_venv=True)
|
||||
@ -30,7 +16,7 @@ def lint(session: nox.Session) -> None:
|
||||
session.run("pre-commit", "run", "-a", *session.posargs)
|
||||
|
||||
|
||||
@nox.session(python=PYTHON_VERSIONS)
|
||||
@nox.session
|
||||
def tests(session: nox.Session) -> None:
|
||||
"""
|
||||
Run the tests (requires a compiler).
|
||||
@ -64,23 +50,35 @@ def tests_packaging(session: nox.Session) -> None:
|
||||
@nox.session(reuse_venv=True)
|
||||
def docs(session: nox.Session) -> None:
|
||||
"""
|
||||
Build the docs. Pass "serve" to serve.
|
||||
Build the docs. Pass --non-interactive to avoid serving.
|
||||
"""
|
||||
|
||||
session.install("-r", "docs/requirements.txt")
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"-b", dest="builder", default="html", help="Build target (default: html)"
|
||||
)
|
||||
args, posargs = parser.parse_known_args(session.posargs)
|
||||
serve = args.builder == "html" and session.interactive
|
||||
|
||||
extra_installs = ["sphinx-autobuild"] if serve else []
|
||||
session.install("-r", "docs/requirements.txt", *extra_installs)
|
||||
session.chdir("docs")
|
||||
|
||||
if "pdf" in session.posargs:
|
||||
session.run("sphinx-build", "-M", "latexpdf", ".", "_build")
|
||||
return
|
||||
shared_args = (
|
||||
"-n", # nitpicky mode
|
||||
"-T", # full tracebacks
|
||||
f"-b={args.builder}",
|
||||
".",
|
||||
f"_build/{args.builder}",
|
||||
*posargs,
|
||||
)
|
||||
|
||||
session.run("sphinx-build", "-M", "html", ".", "_build")
|
||||
|
||||
if "serve" in session.posargs:
|
||||
session.log("Launching docs at http://localhost:8000/ - use Ctrl-C to quit")
|
||||
session.run("python", "-m", "http.server", "8000", "-d", "_build/html")
|
||||
elif session.posargs:
|
||||
session.error("Unsupported argument to docs")
|
||||
if serve:
|
||||
session.run(
|
||||
"sphinx-autobuild", "--open-browser", "--ignore=.build", *shared_args
|
||||
)
|
||||
else:
|
||||
session.run("sphinx-build", "--keep-going", *shared_args)
|
||||
|
||||
|
||||
@nox.session(reuse_venv=True)
|
||||
|
@ -21,7 +21,6 @@ ignore = [
|
||||
files = ["pybind11"]
|
||||
python_version = "3.8"
|
||||
strict = true
|
||||
show_error_codes = true
|
||||
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
|
||||
warn_unreachable = true
|
||||
|
||||
@ -30,18 +29,6 @@ module = ["ghapi.*"]
|
||||
ignore_missing_imports = true
|
||||
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
minversion = "6.0"
|
||||
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
|
||||
xfail_strict = true
|
||||
filterwarnings = ["error"]
|
||||
log_cli_level = "info"
|
||||
testpaths = [
|
||||
"tests",
|
||||
]
|
||||
timeout=300
|
||||
|
||||
|
||||
[tool.pylint]
|
||||
master.py-version = "3.6"
|
||||
reports.output-format = "colorized"
|
||||
@ -93,3 +80,6 @@ isort.known-first-party = ["env", "pybind11_cross_module_tests", "pybind11_tests
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"tests/**" = ["EM", "N", "E721"]
|
||||
"tests/test_call_policies.py" = ["PLC1901"]
|
||||
|
||||
[tool.repo-review]
|
||||
ignore = ["PP"]
|
||||
|
@ -330,7 +330,7 @@ if(Boost_FOUND)
|
||||
add_library(Boost::headers IMPORTED INTERFACE)
|
||||
if(TARGET Boost::boost)
|
||||
# Classic FindBoost
|
||||
set_property(TARGET Boost::boost PROPERTY INTERFACE_LINK_LIBRARIES Boost::boost)
|
||||
set_property(TARGET Boost::headers PROPERTY INTERFACE_LINK_LIBRARIES Boost::boost)
|
||||
else()
|
||||
# Very old FindBoost, or newer Boost than CMake in older CMakes
|
||||
set_property(TARGET Boost::headers PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
||||
|
@ -73,6 +73,7 @@ cmake_files = {
|
||||
"share/cmake/pybind11/pybind11Common.cmake",
|
||||
"share/cmake/pybind11/pybind11Config.cmake",
|
||||
"share/cmake/pybind11/pybind11ConfigVersion.cmake",
|
||||
"share/cmake/pybind11/pybind11GuessPythonExtSuffix.cmake",
|
||||
"share/cmake/pybind11/pybind11NewTools.cmake",
|
||||
"share/cmake/pybind11/pybind11Targets.cmake",
|
||||
"share/cmake/pybind11/pybind11Tools.cmake",
|
||||
|
@ -89,6 +89,8 @@ PYBIND11_MODULE(pybind11_tests, m) {
|
||||
#endif
|
||||
m.attr("cpp_std") = cpp_std();
|
||||
m.attr("PYBIND11_INTERNALS_ID") = PYBIND11_INTERNALS_ID;
|
||||
// Free threaded Python uses UINT32_MAX for immortal objects.
|
||||
m.attr("PYBIND11_REFCNT_IMMORTAL") = UINT32_MAX;
|
||||
m.attr("PYBIND11_SIMPLE_GIL_MANAGEMENT") =
|
||||
#if defined(PYBIND11_SIMPLE_GIL_MANAGEMENT)
|
||||
true;
|
||||
|
@ -20,3 +20,4 @@ filterwarnings =
|
||||
# bogus numpy ABI warning (see numpy/#432)
|
||||
ignore:.*numpy.dtype size changed.*:RuntimeWarning
|
||||
ignore:.*numpy.ufunc size changed.*:RuntimeWarning
|
||||
default:The global interpreter lock:RuntimeWarning
|
||||
|
@ -3,7 +3,7 @@ from unittest import mock
|
||||
import pytest
|
||||
|
||||
import env
|
||||
from pybind11_tests import ConstructorStats, UserType
|
||||
from pybind11_tests import PYBIND11_REFCNT_IMMORTAL, ConstructorStats, UserType
|
||||
from pybind11_tests import class_ as m
|
||||
|
||||
|
||||
@ -377,7 +377,9 @@ def test_class_refcount():
|
||||
refcount_3 = getrefcount(cls)
|
||||
|
||||
assert refcount_1 == refcount_3
|
||||
assert refcount_2 > refcount_1
|
||||
assert (refcount_2 > refcount_1) or (
|
||||
refcount_2 == refcount_1 == PYBIND11_REFCNT_IMMORTAL
|
||||
)
|
||||
|
||||
|
||||
def test_reentrant_implicit_conversion_failure(msg):
|
||||
|
@ -7,6 +7,13 @@ if("${PYTHON_MODULE_EXTENSION}" MATCHES "pypy" OR "${Python_INTERPRETER_ID}" STR
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(TARGET Python::Module AND NOT TARGET Python::Python)
|
||||
message(STATUS "Skipping embed test since no embed libs found")
|
||||
add_custom_target(cpptest) # Dummy target since embedding is not supported.
|
||||
set(_suppress_unused_variable_warning "${DOWNLOAD_CATCH}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_package(Catch 2.13.9)
|
||||
|
||||
if(CATCH_FOUND)
|
||||
|
@ -150,10 +150,13 @@ TEST_SUBMODULE(kwargs_and_defaults, m) {
|
||||
|
||||
// test_args_refcount
|
||||
// PyPy needs a garbage collection to get the reference count values to match CPython's behaviour
|
||||
// PyPy uses the top few bits for REFCNT_FROM_PYPY & REFCNT_FROM_PYPY_LIGHT, so truncate
|
||||
#ifdef PYPY_VERSION
|
||||
# define GC_IF_NEEDED ConstructorStats::gc()
|
||||
# define REFCNT(x) (int) Py_REFCNT(x)
|
||||
#else
|
||||
# define GC_IF_NEEDED
|
||||
# define REFCNT(x) Py_REFCNT(x)
|
||||
#endif
|
||||
m.def("arg_refcount_h", [](py::handle h) {
|
||||
GC_IF_NEEDED;
|
||||
@ -172,7 +175,7 @@ TEST_SUBMODULE(kwargs_and_defaults, m) {
|
||||
py::tuple t(a.size());
|
||||
for (size_t i = 0; i < a.size(); i++) {
|
||||
// Use raw Python API here to avoid an extra, intermediate incref on the tuple item:
|
||||
t[i] = (int) Py_REFCNT(PyTuple_GET_ITEM(a.ptr(), static_cast<py::ssize_t>(i)));
|
||||
t[i] = REFCNT(PyTuple_GET_ITEM(a.ptr(), static_cast<py::ssize_t>(i)));
|
||||
}
|
||||
return t;
|
||||
});
|
||||
@ -182,7 +185,7 @@ TEST_SUBMODULE(kwargs_and_defaults, m) {
|
||||
t[0] = o.ref_count();
|
||||
for (size_t i = 0; i < a.size(); i++) {
|
||||
// Use raw Python API here to avoid an extra, intermediate incref on the tuple item:
|
||||
t[i + 1] = (int) Py_REFCNT(PyTuple_GET_ITEM(a.ptr(), static_cast<py::ssize_t>(i)));
|
||||
t[i + 1] = REFCNT(PyTuple_GET_ITEM(a.ptr(), static_cast<py::ssize_t>(i)));
|
||||
}
|
||||
return t;
|
||||
});
|
||||
|
@ -381,7 +381,7 @@ def test_args_refcount():
|
||||
arguments"""
|
||||
refcount = m.arg_refcount_h
|
||||
|
||||
myval = 54321
|
||||
myval = object()
|
||||
expected = refcount(myval)
|
||||
assert m.arg_refcount_h(myval) == expected
|
||||
assert m.arg_refcount_o(myval) == expected + 1
|
||||
@ -420,6 +420,7 @@ def test_args_refcount():
|
||||
# for the `py::args`; in the previous case, we could simply inc_ref and pass on Python's input
|
||||
# tuple without having to inc_ref the individual elements, but here we can't, hence the extra
|
||||
# refs.
|
||||
assert m.mixed_args_refcount(myval, myval, myval) == (exp3 + 3, exp3 + 3, exp3 + 3)
|
||||
exp3_3 = exp3 + 3
|
||||
assert m.mixed_args_refcount(myval, myval, myval) == (exp3_3, exp3_3, exp3_3)
|
||||
|
||||
assert m.class_default_argument() == "<class 'decimal.Decimal'>"
|
||||
|
@ -135,6 +135,7 @@ TEST_SUBMODULE(pytypes, m) {
|
||||
m.def("list_size_t", []() { return py::list{(py::size_t) 0}; });
|
||||
m.def("list_insert_ssize_t", [](py::list *l) { return l->insert((py::ssize_t) 1, 83); });
|
||||
m.def("list_insert_size_t", [](py::list *l) { return l->insert((py::size_t) 3, 57); });
|
||||
m.def("list_clear", [](py::list *l) { l->clear(); });
|
||||
m.def("get_list", []() {
|
||||
py::list list;
|
||||
list.append("value");
|
||||
|
@ -65,6 +65,8 @@ def test_list(capture, doc):
|
||||
assert lins == [1, 83, 2]
|
||||
m.list_insert_size_t(lins)
|
||||
assert lins == [1, 83, 2, 57]
|
||||
m.list_clear(lins)
|
||||
assert lins == []
|
||||
|
||||
with capture:
|
||||
lst = m.get_list()
|
||||
@ -631,7 +633,8 @@ def test_memoryview(method, args, fmt, expected_view):
|
||||
],
|
||||
)
|
||||
def test_memoryview_refcount(method):
|
||||
buf = b"\x0a\x0b\x0c\x0d"
|
||||
# Avoiding a literal to avoid an immortal object in free-threaded builds
|
||||
buf = "\x0a\x0b\x0c\x0d".encode("ascii")
|
||||
ref_before = sys.getrefcount(buf)
|
||||
view = method(buf)
|
||||
ref_after = sys.getrefcount(buf)
|
||||
|
@ -205,7 +205,7 @@ endif()
|
||||
# Make sure the Python has the same pointer-size as the chosen compiler
|
||||
# Skip if CMAKE_SIZEOF_VOID_P is not defined
|
||||
# This should be skipped for (non-Apple) cross-compiles (like EMSCRIPTEN)
|
||||
if(NOT CMAKE_CROSSCOMPILING
|
||||
if(NOT _PYBIND11_CROSSCOMPILING
|
||||
AND CMAKE_SIZEOF_VOID_P
|
||||
AND (NOT "${PYTHON_SIZEOF_VOID_P}" STREQUAL "${CMAKE_SIZEOF_VOID_P}"))
|
||||
if(PythonLibsNew_FIND_REQUIRED)
|
||||
|
@ -42,6 +42,16 @@ set(pybind11_INCLUDE_DIRS
|
||||
"${pybind11_INCLUDE_DIR}"
|
||||
CACHE INTERNAL "Include directory for pybind11 (Python not requested)")
|
||||
|
||||
if(CMAKE_CROSSCOMPILING AND PYBIND11_USE_CROSSCOMPILING)
|
||||
set(_PYBIND11_CROSSCOMPILING
|
||||
ON
|
||||
CACHE INTERNAL "")
|
||||
else()
|
||||
set(_PYBIND11_CROSSCOMPILING
|
||||
OFF
|
||||
CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
# --------------------- Shared targets ----------------------------
|
||||
|
||||
# Build an interface library target:
|
||||
@ -195,7 +205,7 @@ endif()
|
||||
|
||||
# --------------------- pybind11_find_import -------------------------------
|
||||
|
||||
if(NOT _pybind11_nopython)
|
||||
if(NOT _pybind11_nopython AND NOT _PYBIND11_CROSSCOMPILING)
|
||||
# Check to see if modules are importable. Use REQUIRED to force an error if
|
||||
# one of the modules is not found. <package_name>_FOUND will be set if the
|
||||
# package was found (underscores replace dashes if present). QUIET will hide
|
||||
|
86
tools/pybind11GuessPythonExtSuffix.cmake
Normal file
86
tools/pybind11GuessPythonExtSuffix.cmake
Normal file
@ -0,0 +1,86 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
function(pybind11_guess_python_module_extension python)
|
||||
|
||||
# The SETUPTOOLS_EXT_SUFFIX environment variable takes precedence:
|
||||
if(NOT DEFINED PYTHON_MODULE_EXT_SUFFIX AND DEFINED ENV{SETUPTOOLS_EXT_SUFFIX})
|
||||
message(
|
||||
STATUS
|
||||
"Getting Python extension suffix from ENV{SETUPTOOLS_EXT_SUFFIX}: $ENV{SETUPTOOLS_EXT_SUFFIX}"
|
||||
)
|
||||
set(PYTHON_MODULE_EXT_SUFFIX
|
||||
"$ENV{SETUPTOOLS_EXT_SUFFIX}"
|
||||
CACHE
|
||||
STRING
|
||||
"Extension suffix for Python extension modules (Initialized from SETUPTOOLS_EXT_SUFFIX)")
|
||||
endif()
|
||||
# If that didn't work, use the Python_SOABI variable:
|
||||
if(NOT DEFINED PYTHON_MODULE_EXT_SUFFIX AND DEFINED ${python}_SOABI)
|
||||
message(
|
||||
STATUS "Determining Python extension suffix based on ${python}_SOABI: ${${python}_SOABI}")
|
||||
# The final extension depends on the system
|
||||
set(_PY_BUILD_EXTENSION "${CMAKE_SHARED_MODULE_SUFFIX}")
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
set(_PY_BUILD_EXTENSION ".pyd")
|
||||
endif()
|
||||
# If the SOABI already has an extension, use it as the full suffix
|
||||
# (used for debug versions of Python on Windows)
|
||||
if(${python}_SOABI MATCHES "\\.")
|
||||
set(PYTHON_MODULE_EXT_SUFFIX "${${python}_SOABI}")
|
||||
# If the SOABI is empty, this is usually a bug, but we generate a
|
||||
# correct extension anyway, which is the best we can do
|
||||
elseif("${${python}_SOABI}" STREQUAL "")
|
||||
message(
|
||||
WARNING
|
||||
"${python}_SOABI is defined but empty. You may want to set PYTHON_MODULE_EXT_SUFFIX explicitly."
|
||||
)
|
||||
set(PYTHON_MODULE_EXT_SUFFIX "${_PY_BUILD_EXTENSION}")
|
||||
# Otherwise, add the system-dependent extension to it
|
||||
else()
|
||||
set(PYTHON_MODULE_EXT_SUFFIX ".${${python}_SOABI}${_PY_BUILD_EXTENSION}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If we could not deduce the extension suffix, unset the results:
|
||||
if(NOT DEFINED PYTHON_MODULE_EXT_SUFFIX)
|
||||
unset(PYTHON_MODULE_DEBUG_POSTFIX PARENT_SCOPE)
|
||||
unset(PYTHON_MODULE_EXTENSION PARENT_SCOPE)
|
||||
unset(PYTHON_IS_DEBUG PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Sanity checks:
|
||||
if(${python}_SOABI AND NOT (PYTHON_MODULE_EXT_SUFFIX STREQUAL ${python}_SOABI
|
||||
OR PYTHON_MODULE_EXT_SUFFIX MATCHES "\\.${${python}_SOABI}\\."))
|
||||
message(
|
||||
WARNING
|
||||
"Python extension suffix (${PYTHON_MODULE_EXT_SUFFIX}) does not match ${python}_SOABI (${${python}_SOABI})."
|
||||
)
|
||||
endif()
|
||||
|
||||
# Separate file name postfix from extension: (https://github.com/pybind/pybind11/issues/4699)
|
||||
get_filename_component(_PYTHON_MODULE_DEBUG_POSTFIX "${PYTHON_MODULE_EXT_SUFFIX}" NAME_WE)
|
||||
get_filename_component(_PYTHON_MODULE_EXTENSION "${PYTHON_MODULE_EXT_SUFFIX}" EXT)
|
||||
|
||||
# Try to deduce the debug ABI from the extension suffix:
|
||||
if(NOT DEFINED _PYTHON_IS_DEBUG)
|
||||
if(_PYTHON_MODULE_EXTENSION MATCHES "^\\.(cpython-|cp|pypy)[0-9]+dm?-"
|
||||
OR _PYTHON_MODULE_DEBUG_POSTFIX MATCHES "^_d")
|
||||
set(_PYTHON_IS_DEBUG On)
|
||||
else()
|
||||
set(_PYTHON_IS_DEBUG Off)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Return results
|
||||
set(PYTHON_MODULE_DEBUG_POSTFIX
|
||||
"${_PYTHON_MODULE_DEBUG_POSTFIX}"
|
||||
PARENT_SCOPE)
|
||||
set(PYTHON_MODULE_EXTENSION
|
||||
"${_PYTHON_MODULE_EXTENSION}"
|
||||
PARENT_SCOPE)
|
||||
set(PYTHON_IS_DEBUG
|
||||
"${_PYTHON_IS_DEBUG}"
|
||||
PARENT_SCOPE)
|
||||
|
||||
endfunction()
|
@ -32,6 +32,13 @@ if(NOT Python_FOUND AND NOT Python3_FOUND)
|
||||
set(Python_ROOT_DIR "$ENV{pythonLocation}")
|
||||
endif()
|
||||
|
||||
# Interpreter should not be found when cross-compiling
|
||||
if(_PYBIND11_CROSSCOMPILING)
|
||||
set(_pybind11_interp_component "")
|
||||
else()
|
||||
set(_pybind11_interp_component Interpreter)
|
||||
endif()
|
||||
|
||||
# Development.Module support (required for manylinux) started in 3.18
|
||||
if(CMAKE_VERSION VERSION_LESS 3.18)
|
||||
set(_pybind11_dev_component Development)
|
||||
@ -48,7 +55,8 @@ if(NOT Python_FOUND AND NOT Python3_FOUND)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(Python 3.6 REQUIRED COMPONENTS Interpreter ${_pybind11_dev_component}
|
||||
find_package(
|
||||
Python 3.6 REQUIRED COMPONENTS ${_pybind11_interp_component} ${_pybind11_dev_component}
|
||||
${_pybind11_quiet} ${_pybind11_global_keyword})
|
||||
|
||||
# If we are in submodule mode, export the Python targets to global targets.
|
||||
@ -59,7 +67,9 @@ if(NOT Python_FOUND AND NOT Python3_FOUND)
|
||||
if(TARGET Python::Python)
|
||||
set_property(TARGET Python::Python PROPERTY IMPORTED_GLOBAL TRUE)
|
||||
endif()
|
||||
if(TARGET Python::Interpreter)
|
||||
set_property(TARGET Python::Interpreter PROPERTY IMPORTED_GLOBAL TRUE)
|
||||
endif()
|
||||
if(TARGET Python::Module)
|
||||
set_property(TARGET Python::Module PROPERTY IMPORTED_GLOBAL TRUE)
|
||||
endif()
|
||||
@ -100,13 +110,15 @@ if(PYBIND11_MASTER_PROJECT)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT _PYBIND11_CROSSCOMPILING)
|
||||
# If a user finds Python, they may forget to include the Interpreter component
|
||||
# and the following two steps require it. It is highly recommended by CMake
|
||||
# when finding development libraries anyway, so we will require it.
|
||||
if(NOT DEFINED ${_Python}_EXECUTABLE)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"${_Python} was found without the Interpreter component. Pybind11 requires this component.")
|
||||
"${_Python} was found without the Interpreter component. Pybind11 requires this component."
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
@ -145,9 +157,9 @@ if(NOT DEFINED PYTHON_MODULE_EXTENSION OR NOT DEFINED PYTHON_MODULE_DEBUG_POSTFI
|
||||
|
||||
if(_PYTHON_MODULE_EXT_SUFFIX STREQUAL "")
|
||||
message(
|
||||
FATAL_ERROR "pybind11 could not query the module file extension, likely the 'distutils'"
|
||||
"package is not installed. Full error message:\n${_PYTHON_MODULE_EXT_SUFFIX_ERR}"
|
||||
)
|
||||
FATAL_ERROR
|
||||
"pybind11 could not query the module file extension, likely the 'distutils'"
|
||||
"package is not installed. Full error message:\n${_PYTHON_MODULE_EXT_SUFFIX_ERR}")
|
||||
endif()
|
||||
|
||||
# This needs to be available for the pybind11_extension function
|
||||
@ -165,6 +177,24 @@ if(NOT DEFINED PYTHON_MODULE_EXTENSION OR NOT DEFINED PYTHON_MODULE_DEBUG_POSTFI
|
||||
CACHE INTERNAL "")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
if(NOT DEFINED PYTHON_IS_DEBUG
|
||||
OR NOT DEFINED PYTHON_MODULE_EXTENSION
|
||||
OR NOT DEFINED PYTHON_MODULE_DEBUG_POSTFIX)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/pybind11GuessPythonExtSuffix.cmake")
|
||||
pybind11_guess_python_module_extension("${_Python}")
|
||||
endif()
|
||||
# When cross-compiling, we cannot query the Python interpreter, so we require
|
||||
# the user to set these variables explicitly.
|
||||
if(NOT DEFINED PYTHON_IS_DEBUG
|
||||
OR NOT DEFINED PYTHON_MODULE_EXTENSION
|
||||
OR NOT DEFINED PYTHON_MODULE_DEBUG_POSTFIX)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"When cross-compiling, you should set the PYTHON_IS_DEBUG, PYTHON_MODULE_EXTENSION and PYTHON_MODULE_DEBUG_POSTFIX \
|
||||
variables appropriately before loading pybind11 (e.g. in your CMake toolchain file)")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Python debug libraries expose slightly different objects before 3.8
|
||||
# https://docs.python.org/3.6/c-api/intro.html#debugging-builds
|
||||
|
161
tools/test-pybind11GuessPythonExtSuffix.cmake
Normal file
161
tools/test-pybind11GuessPythonExtSuffix.cmake
Normal file
@ -0,0 +1,161 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
# Tests for pybind11_guess_python_module_extension
|
||||
# Run using `cmake -P tools/test-pybind11GuessPythonExtSuffix.cmake`
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/pybind11GuessPythonExtSuffix.cmake")
|
||||
|
||||
macro(expect_streq actual expected)
|
||||
if(NOT "${actual}" STREQUAL "${expected}")
|
||||
message(SEND_ERROR "Fail\n *** actual: '${actual}'\n *** expected: '${expected}'")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(expect_false actual)
|
||||
if("${actual}")
|
||||
message(SEND_ERROR "Fail\n *** actual: '${actual}'\n *** expected: false")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(expect_true actual)
|
||||
if(NOT "${actual}")
|
||||
message(SEND_ERROR "Fail\n *** actual: '${actual}'\n *** expected: true")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Windows
|
||||
set(CMAKE_SYSTEM_NAME "Windows")
|
||||
set(CMAKE_SHARED_MODULE_SUFFIX ".dll")
|
||||
|
||||
set(Python3_SOABI "")
|
||||
pybind11_guess_python_module_extension("Python3")
|
||||
expect_streq("${PYTHON_MODULE_EXTENSION}" ".pyd")
|
||||
expect_streq("${PYTHON_MODULE_DEBUG_POSTFIX}" "")
|
||||
expect_false("${PYTHON_IS_DEBUG}")
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX)
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX CACHE)
|
||||
|
||||
set(Python3_SOABI "cp311-win_arm64")
|
||||
pybind11_guess_python_module_extension("Python3")
|
||||
expect_streq("${PYTHON_MODULE_EXTENSION}" ".cp311-win_arm64.pyd")
|
||||
expect_streq("${PYTHON_MODULE_DEBUG_POSTFIX}" "")
|
||||
expect_false("${PYTHON_IS_DEBUG}")
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX)
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX CACHE)
|
||||
|
||||
set(Python3_SOABI "cp311d-win_arm64")
|
||||
pybind11_guess_python_module_extension("Python3")
|
||||
expect_streq("${PYTHON_MODULE_EXTENSION}" ".cp311d-win_arm64.pyd")
|
||||
expect_streq("${PYTHON_MODULE_DEBUG_POSTFIX}" "")
|
||||
expect_true("${PYTHON_IS_DEBUG}")
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX)
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX CACHE)
|
||||
|
||||
set(Python3_SOABI "pypy310-pp73-win_amd64")
|
||||
pybind11_guess_python_module_extension("Python3")
|
||||
expect_streq("${PYTHON_MODULE_EXTENSION}" ".pypy310-pp73-win_amd64.pyd")
|
||||
expect_streq("${PYTHON_MODULE_DEBUG_POSTFIX}" "")
|
||||
expect_false("${PYTHON_IS_DEBUG}")
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX)
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX CACHE)
|
||||
|
||||
set(Python3_SOABI "_d.cp311-win_amd64.pyd") # This is a quirk of FindPython3
|
||||
pybind11_guess_python_module_extension("Python3")
|
||||
expect_streq("${PYTHON_MODULE_EXTENSION}" ".cp311-win_amd64.pyd")
|
||||
expect_streq("${PYTHON_MODULE_DEBUG_POSTFIX}" "_d")
|
||||
expect_true("${PYTHON_IS_DEBUG}")
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX)
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX CACHE)
|
||||
|
||||
unset(Python3_SOABI)
|
||||
set(ENV{SETUPTOOLS_EXT_SUFFIX} ".cp39-win_arm64.pyd") # Set by cibuildwheel
|
||||
pybind11_guess_python_module_extension("Python3")
|
||||
expect_streq("${PYTHON_MODULE_EXTENSION}" ".cp39-win_arm64.pyd")
|
||||
expect_streq("${PYTHON_MODULE_DEBUG_POSTFIX}" "")
|
||||
expect_false("${PYTHON_IS_DEBUG}")
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX)
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX CACHE)
|
||||
unset(ENV{SETUPTOOLS_EXT_SUFFIX})
|
||||
|
||||
set(Python3_SOABI "cp311-win_arm64")
|
||||
set(ENV{SETUPTOOLS_EXT_SUFFIX} "") # Should not be used
|
||||
pybind11_guess_python_module_extension("Python3")
|
||||
expect_streq("${PYTHON_MODULE_EXTENSION}" ".cp311-win_arm64.pyd")
|
||||
expect_streq("${PYTHON_MODULE_DEBUG_POSTFIX}" "")
|
||||
expect_false("${PYTHON_IS_DEBUG}")
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX)
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX CACHE)
|
||||
unset(ENV{SETUPTOOLS_EXT_SUFFIX})
|
||||
|
||||
# macOS
|
||||
set(CMAKE_SYSTEM_NAME "Darwin")
|
||||
set(CMAKE_SHARED_MODULE_SUFFIX ".so")
|
||||
|
||||
set(Python3_SOABI "")
|
||||
pybind11_guess_python_module_extension("Python3")
|
||||
expect_streq("${PYTHON_MODULE_EXTENSION}" ".so")
|
||||
expect_streq("${PYTHON_MODULE_DEBUG_POSTFIX}" "")
|
||||
expect_false("${PYTHON_IS_DEBUG}")
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX)
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX CACHE)
|
||||
|
||||
set(Python3_SOABI "cpython-312-darwin")
|
||||
pybind11_guess_python_module_extension("Python3")
|
||||
expect_streq("${PYTHON_MODULE_EXTENSION}" ".cpython-312-darwin.so")
|
||||
expect_streq("${PYTHON_MODULE_DEBUG_POSTFIX}" "")
|
||||
expect_false("${PYTHON_IS_DEBUG}")
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX)
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX CACHE)
|
||||
|
||||
set(Python3_SOABI "cpython-312d-darwin")
|
||||
pybind11_guess_python_module_extension("Python3")
|
||||
expect_streq("${PYTHON_MODULE_EXTENSION}" ".cpython-312d-darwin.so")
|
||||
expect_streq("${PYTHON_MODULE_DEBUG_POSTFIX}" "")
|
||||
expect_true("${PYTHON_IS_DEBUG}")
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX)
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX CACHE)
|
||||
|
||||
# Linux
|
||||
set(CMAKE_SYSTEM_NAME "Linux")
|
||||
set(CMAKE_SHARED_MODULE_SUFFIX ".so")
|
||||
|
||||
set(Python3_SOABI "")
|
||||
pybind11_guess_python_module_extension("Python3")
|
||||
expect_streq("${PYTHON_MODULE_EXTENSION}" ".so")
|
||||
expect_streq("${PYTHON_MODULE_DEBUG_POSTFIX}" "")
|
||||
expect_false("${PYTHON_IS_DEBUG}")
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX)
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX CACHE)
|
||||
|
||||
set(Python3_SOABI "cpython-312-arm-linux-gnueabihf")
|
||||
pybind11_guess_python_module_extension("Python3")
|
||||
expect_streq("${PYTHON_MODULE_EXTENSION}" ".cpython-312-arm-linux-gnueabihf.so")
|
||||
expect_streq("${PYTHON_MODULE_DEBUG_POSTFIX}" "")
|
||||
expect_false("${PYTHON_IS_DEBUG}")
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX)
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX CACHE)
|
||||
|
||||
set(Python3_SOABI "cpython-312d-arm-linux-gnueabihf")
|
||||
pybind11_guess_python_module_extension("Python3")
|
||||
expect_streq("${PYTHON_MODULE_EXTENSION}" ".cpython-312d-arm-linux-gnueabihf.so")
|
||||
expect_streq("${PYTHON_MODULE_DEBUG_POSTFIX}" "")
|
||||
expect_true("${PYTHON_IS_DEBUG}")
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX)
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX CACHE)
|
||||
|
||||
set(Python3_SOABI "pypy310-pp73-x86_64-linux-gnu")
|
||||
pybind11_guess_python_module_extension("Python3")
|
||||
expect_streq("${PYTHON_MODULE_EXTENSION}" ".pypy310-pp73-x86_64-linux-gnu.so")
|
||||
expect_streq("${PYTHON_MODULE_DEBUG_POSTFIX}" "")
|
||||
expect_false("${PYTHON_IS_DEBUG}")
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX)
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX CACHE)
|
||||
|
||||
set(Python3_SOABI "pypy310d-pp73-x86_64-linux-gnu")
|
||||
# TODO: I'm not sure if this is the right SOABI for PyPy debug builds
|
||||
pybind11_guess_python_module_extension("Python3")
|
||||
expect_streq("${PYTHON_MODULE_EXTENSION}" ".pypy310d-pp73-x86_64-linux-gnu.so")
|
||||
expect_streq("${PYTHON_MODULE_DEBUG_POSTFIX}" "")
|
||||
expect_true("${PYTHON_IS_DEBUG}")
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX)
|
||||
unset(PYTHON_MODULE_EXT_SUFFIX CACHE)
|
Loading…
Reference in New Issue
Block a user