100 Commits
Author SHA1 Message Date
Henry SchreinerandRalf W. Grosse-Kunstleve 08f89f7b21 chore: add prepare-release and publish-release agent skills (#6147)
* chore: add prepare-release and publish-release agent skills

Split the release process from docs/release.rst into two agent skills:
a changelog/version-bump PR, and the manual publication steps after
that PR merges. Un-ignore .agents (the MSVC 'Release' pattern matched
the release skill directory case-insensitively) and drop the outdated
manual _version.py step from docs/release.rst.

Assisted-by: ClaudeCode:claude-fable-5

* [no ci] chore: document changelog style normalization in release skill

Teach the prepare-release skill to proofread generated changelog entries for tense, concision, categorization, and PR-link consistency before opening release-prep PRs.

* [no ci] chore: fix release skill portability

* [no ci] fix: harden release workflows

* [no ci] docs: show explicit manual artifact upload

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2026-08-23 00:58:05 -04:00
Henry Schreiner a49c4dbfa4 chore(cmake): carry option-driven defines on pybind11_headers INTERFACE (#6130)
* chore(cmake): carry option-driven defines on pybind11_headers INTERFACE

PYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION and
PYBIND11_SIMPLE_GIL_MANAGEMENT were directory-scoped
add_compile_definitions, which only reached the master-project test
build. On the pybind11_headers INTERFACE (like
PYBIND11_INTERNALS_VERSION) they also apply in add_subdirectory mode
and in the exported/installed targets.

Assisted-by: ClaudeCode:claude-fable-5

* test(cmake): verify option-driven defines reach consumer targets

Extend subdirectory_target and installed_target to check that
PYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION and
PYBIND11_SIMPLE_GIL_MANAGEMENT propagate through the pybind11_headers
usage requirements. Fails without the parent commit.

Assisted-by: ClaudeCode:claude-fable-5
2026-08-17 00:50:31 -04:00
Henry Schreiner 0599909bfe fix: returning a copyable type with a deleted move constructor (#6143)
* fix: returning a copyable type with a deleted move constructor (#6142)

detail::function_ref's constructor SFINAE required
is_convertible<Ret, Ret>, which is false for a copyable type whose move
constructor is explicitly deleted (the trait tests conversion from an
xvalue). In C++17, such a prvalue return is legal via guaranteed copy
elision, so also accept an exact type match. Regression introduced in
3.1.0 by the call_impl outlining (#5887).

Fixes #6142

Assisted-by: ClaudeCode:claude-fable-5

* refactor: guard with __cpp_guaranteed_copy_elision

Per review: the feature-test macro expresses the intent more precisely
than PYBIND11_CPP17.

Assisted-by: ClaudeCode:claude-opus-5
2026-08-14 16:33:49 -04:00
Henry SchreinerandRalf W. Grosse-Kunstleve 97bf890db6 chore: prepare 3.1.0 release (#6125)
* docs: add 3.1 entries to the changelog

Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>

* chore: prepare 3.1.0 release

Assisted-by: ClaudeCode:claude-opus-5

* [skip ci] Change release date to August 4, 2026

* docs: add #6127 entry and set release date to August 6, 2026

Assisted-by: ClaudeCode:claude-opus-5

---------

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgkio@gmail.com>
2026-08-06 11:44:21 -04:00
Henry SchreinerandRalf W. Grosse-Kunstleve 63d627c574 feat!: drop support for Python 3.8, MSVC 2017 (#6110)
* feat!: drop support for Python 3.8

The minimum supported version is now Python 3.9. pybind11 v3.0 was the last
release that supports Python 3.8. The deprecation note said that support goes
away in 3.1.

Remove the code paths that this makes dead:

- the `_PyObject_Vectorcall` fallback in `cast.h`
- the `frame->f_code` and `frame->f_back` fallbacks in `pytypes.h`
- the `PyFrame_FastToLocals` path in `get_type_override`
- the conditional `Py_VISIT(Py_TYPE(self))` in `tp_traverse`
- `PYBIND11_PYCONFIG_SUPPORT_PY_VERSION_HEX`, the pre-PyConfig interpreter
  init, and the `widen_chars` helpers in `embed.h`

Assisted-by: ClaudeCode:claude-opus-5

* ci(appveyor): use Python 3.9

The AppVeyor job set `PYTHON: 38`, which makes the path `C:\Python38`.
The image gives Python 3.9.13 as `C:\Python39`.

Assisted-by: ClaudeCode:claude-opus-5

* feat!: require MSVC 2019 or newer

Python 3.9 is the new minimum, so MSVC 2017 is no longer needed. Raise the
compile-time floor to _MSC_VER 1920 and remove the workarounds that only
applied below it: std::launder, fold expressions, weak_from_this, aligned
new/delete, the C4100 warning helper, and the func_handle syntax error.

AppVeyor now builds with Visual Studio 2019.

Assisted-by: ClaudeCode:claude-opus-5

* fix(appveyor): build against the Python that has the test packages

CMake 4 has no FindPythonLibs, so pybind11 uses FindPython. FindPython reads
the registry before PATH and selected `C:\Python314-x64`, but the test packages
go into the Python on PATH. Pass `Python_ROOT_DIR` to name the correct one.

Also set `CMAKE_ARCH`. It was never set, so the architecture came from the
generator. Visual Studio 2017 defaults to Win32, but Visual Studio 2019
defaults to x64, which made this x86 job build 64-bit code.

Assisted-by: ClaudeCode:claude-opus-5

* fix(appveyor): give the linker Python's libs directory

The build compiled but failed to link with LNK1104 on a bare `python39.lib`.
That name comes from the `#pragma comment(lib, ...)` in pyconfig.h, so the
linker needs the directory. CMake 4 has no FindPythonLibs, and FindPython does
not add it for this Debug x86 build. Put it on LIB instead.

The directory listing is temporary, to confirm the library is present.

Assisted-by: ClaudeCode:claude-opus-5

* fix(appveyor): link the release Python library in Debug

The image ships python39_d.lib next to python39.lib, so FindPython picks the
debug import library for a Debug build. pybind11 undefines _DEBUG around
Python.h, so pyconfig.h asks for python39.lib instead and the link failed with
LNK1104. Name the release library for the debug slot.

Setting LIB does not work, because MSBuild replaces it from the toolset, and it
would link both import libraries.

Assisted-by: ClaudeCode:claude-opus-5

* chore(appveyor): print link settings to debug LNK1104

Revert the two attempted fixes. Neither changed the failure: setting LIB does
not survive MSBuild, and naming the release library for Python_LIBRARY_DEBUG
had no effect.

Print the Python cache entries and the link settings of a generated project
file instead, to see what the linker really gets. Temporary.

Assisted-by: ClaudeCode:claude-opus-5

* fix(appveyor): take the release Python library in Debug

The generated project file linked C:\Python39\libs\python39_d.lib in the Debug
configuration, because the image ships debug binaries next to the release ones.
pybind11 undefines _DEBUG around Python.h, so pyconfig.h asks for python39.lib
in a #pragma comment(lib), which nothing on the link line satisfies and no
library directory holds. Map Debug to the release artifacts.

Assisted-by: ClaudeCode:claude-opus-5

* chore(appveyor): drop the temporary link diagnostic

Assisted-by: ClaudeCode:claude-opus-5

* fix(tests): guard the unraisable warning filter for pytest < 6

The distro pytest in the Clang and GCC Docker jobs has no
PytestUnraisableExceptionWarning, so an unconditional filterwarnings
mark makes pytest fail with an INTERNALERROR after the tests pass.

Assisted-by: ClaudeCode:claude-opus-5

Claude-Session: https://claude.ai/code/session_01Aimf6HuSz1vLRwBnbxmCTc

* docs: address review items on version hints, embed docs, and a PyPy xfail

Extend Python_ADDITIONAL_VERSIONS through 3.15, describe the PyConfig
behavior of initialize_interpreter, and drop the stale Python 3.8 wording
from the PyPy xfail reason.

Assisted-by: ClaudeCode:claude-opus-5

* Update README.rst

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgkio@gmail.com>

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgkio@gmail.com>
2026-07-31 22:04:32 -07:00
Henry Schreiner ea9e6e6a23 feat: small command line helpers for quick tests (#4272)
* feat: small command line helpers for quick tests

Add --cflags, --ldflags, --embed, and --file to the pybind11 command
line tool, based on python-config. This makes quick one-off compiles
easy:

    c++ $(python3 -m pybind11 --file=example.cpp)

Assisted-by: ClaudeCode:claude-fable-5

* refactor: quote paths, clarify CLI output logic, strengthen tests

- Quote include and library dirs in get_cflags/get_ldflags so paths with
  spaces work, sharing one quote helper in commands.py
- Restructure the --file/--cflags/--ldflags printing into a single print
- Note the Unix-compiler orientation in help text and docs
- Test -L presence for --embed and quoting of paths with spaces

Assisted-by: ClaudeCode:claude-fable-5

* refactor: simplify flag helpers and keep import pybind11 light

- Replace _get_config_var(name, fmt, quote) with a plain _config(name)
  string helper; formatting and quoting happen at the call sites
- Defer sysconfig/shlex imports so import pybind11 does not pay for the
  CLI (~1ms -> ~0.08ms for pybind11.commands)
- Fetch EXT_SUFFIX once in main()
- Import commands normally in the quoting test instead of importlib
  file loading

Assisted-by: ClaudeCode:claude-fable-5

* fix: shared-library flags on all Unix platforms

The --file/--ldflags output only added -shared and -fPIC on Linux, so
other Unix platforms (FreeBSD, Solaris, AIX) linked an executable and
failed on the missing main. Gate on os.name instead.

Assisted-by: ClaudeCode:claude-opus-5
2026-07-31 14:17:21 -04:00
Henry Schreinerandpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> 652c69437b fix: add py::mod_gil_used() spelling, support pedantic tests (#5797)
* tests: add linking warnings/error

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: check pedantic C++14

* fix: some pedantic warnings

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* feat: add py::mod_gil_used()

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: use not_supported()

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* style: pre-commit fixes

* Update CMakeLists.txt

* fix: remove the true/false parameter from mod_gil_not_used

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* style: pre-commit fixes

* Update tests/CMakeLists.txt

* fix: deprecate mod_gil_not_used(bool) instead of removing it

Keep the bool constructor public and mark it deprecated, so existing
code that spells mod_gil_not_used(false) still compiles. mod_gil_used()
now sets the flag through its friendship, which keeps the deprecated
constructor the only bool overload and stops pybind11 warning against
itself.

Also use the py:: alias in exo_planet_pybind11.cpp to match its sibling
home_planet_very_lonely_traveler.cpp.

Assisted-by: ClaudeCode:claude-opus-5

* fix: add trailing comma to macros picked up in rebase

test_smart_ptr.cpp and standalone_enum_module.cpp came from master after
this branch was written, so they still invoked variadic macros with no
variadic argument. That is a pedantic error below C++20.

Assisted-by: ClaudeCode:claude-opus-5

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-07-29 14:53:47 -04:00
Henry SchreinerandRalf W. Grosse-Kunstleve 2f85cc8c4a chore(ci): bump NVHPC to 26.5 (#6117)
* chore(ci): bump NVHPC to 26.5

Assisted-by: ClaudeCode:claude-opus-5

* chore(ci): download NVHPC deb with curl retries to dodge CDN 404s

Assisted-by: ClaudeCode:claude-fable-5

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2026-07-29 12:51:20 -04:00
Henry SchreinerandRalf W. Grosse-Kunstleve 5540f96802 fix: only add string_view life support for transient sources (#6096)
* revert: "revert: add life support to handles cast to string_view (#6092)"

This re-applies #6092 (reverting #6097) so the follow-up fixes in this PR can build on it.

Assisted-by: ClaudeCode:claude-opus-4.8

* fix: don't throw from string_view life support outside a bound function

PR #6092 added loader_life_support::add_patient(src) to keep the source
object alive when loading a string view, fixing a real use-after-free when
a container of views is built from a non-sequence iterable (e.g. a
generator): list_caster materializes a temporary tuple that owns the
strings and destroys it when load() returns, before the bound function
body runs.

add_patient throws when there is no life support frame, so casting to a
view outside a bound function (e.g. a manual py::cast<std::string_view>)
now raises instead of relying on the caller-owned source, a regression
from #6092.

For these view-into-src cases registration is best effort: inside a bound
function it keeps src alive (fixing the UAF), and outside one the caller
owns src's lifetime as before. Add try_add_patient(), which returns false
instead of throwing when there is no frame, and use it at the three view
load sites. add_patient() keeps its strict contract for value-creating
conversions.

Assisted-by: ClaudeCode:claude-opus-4.8

* fix: only add string_view life support for transient sources

Refine the previous commit. Best-effort registration (try_add_patient)
silently produces a dangling view when a container of views is built from
a generator outside a bound function: there the materialized temporary is
released before the view is used, and with no frame nothing keeps it
alive. Such a cast cannot be made safe, so it should fail loudly, while a
view into a durable, caller-owned object needs no life support at all.

The view caster cannot tell a durable source from a pybind11-managed
transient one; that provenance lives in the container caster. Introduce an
ambient transient_source_guard that the list, set, map, and array casters
set around their generator/materialized paths, and have the string caster
keep the source alive only when loading from a transient source (via the
throwing add_patient, so try_add_patient is no longer needed). This means:

- views into durable sources (direct arguments, sequences, manual casts)
  add no life support and no longer throw outside a bound function, and
- a generator used outside a frame throws, rather than silently dangling.

The guard restores (rather than clears) the previous value, so a durable
container nested in a transient one is correctly treated as transient.

Verified with AddressSanitizer: the in-frame generator case is clean, the
out-of-frame durable cases succeed, and the out-of-frame generator case
throws.

Assisted-by: ClaudeCode:claude-opus-4.8

* Revert "fix: only add string_view life support for transient sources"

This reverts commit e18b8346a2.

* test: cover string_view argument life support

* test: cover generated and nested string_view lifetimes

* test: cover temporary-backed string_view casts

* test: explain string_view lifetime regression tests

* docs: clarify string_view lifetime requirements

* docs: explain life support for custom view casters

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2026-07-28 18:53:36 -07:00
Henry Schreiner a647cddd4e fix(cmake): respect explicit PYBIND11_USE_CROSSCOMPILING under CMP0190 (#6094)
* fix(cmake): respect explicit PYBIND11_USE_CROSSCOMPILING under CMP0190

PR #5829 added `AND NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR` to the
condition setting `_PYBIND11_CROSSCOMPILING`. That gate was meant to only
control the auto-default of `PYBIND11_USE_CROSSCOMPILING`, but it ended up
overriding a value the project set explicitly. Emscripten/Pyodide defines
`CMAKE_CROSSCOMPILING_EMULATOR` (node) yet still wants cross-compiling
mode, so the flag was forced OFF and the build failed with a spurious
"Cannot run the interpreter" / pointer-size mismatch.

Move the emulator check up so it only guards the auto-default, and never
override an explicitly set `PYBIND11_USE_CROSSCOMPILING`.

Fixes #6043

Assisted-by: ClaudeCode:claude-opus-4.8

* fix(cmake): keep CMP0190 auto-default in add_subdirectory builds

The previous commit's `NOT DEFINED PYBIND11_USE_CROSSCOMPILING` guard
broke the intended auto-default for top-level / add_subdirectory builds:
CMakeLists.txt runs `option(PYBIND11_USE_CROSSCOMPILING ... OFF)` before
including pybind11Common.cmake, so the variable is already defined (OFF)
and the CMP0190 default never applied.

Capture, before the option() call, whether the project set the value
itself, and let pybind11Common.cmake apply its default unless the value
was set explicitly. This keeps both the emulator override fix and the
CMP0190 auto-default for subdirectory consumers.

Assisted-by: ClaudeCode:claude-opus-4.8
2026-07-27 09:41:15 -04:00
Henry Schreiner 95ebcb3643 chore(tools): make_changelog missed and resurrected PRs (#6108) 2026-07-27 01:41:07 -04:00
Henry Schreiner f4d31b743d fix(cmake): don't pass -fno-fat-lto-objects on Apple GCC (#6114)
GCC on macOS has no linker plugin, so `-fno-fat-lto-objects` makes every
LTO probe fail and LTO is silently disabled. Plain `-flto=auto` works.

Fixes #6060

Assisted-by: ClaudeCode:claude-opus-5
Claude-Session: https://claude.ai/code/session_013JABmnjt9oAh29p1pytAB3
2026-07-26 21:26:04 -07:00
Henry SchreinerandRalf W. Grosse-Kunstleve f95b7a5860 fix: include complex in std::complex input annotation (#6113)
* fix: include `complex` in std::complex input annotation

The input annotation for `std::complex<T>` omitted the builtin `complex`
type, which typeshed only makes a `typing.SupportsComplex` on Python 3.11+.

Assisted-by: ClaudeCode:claude-opus-5
Claude-Session: https://claude.ai/code/session_013JABmnjt9oAh29p1pytAB3

* Add comment to explain why the explicit `complex` is needed.

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2026-07-26 21:25:24 -07:00
Henry Schreiner 17b3b605a5 test: remove dead PR3068 workaround branch (#6109)
`WORKAROUND_ENABLING_ROLLBACK_OF_PR3068` compared the 5-element
`sys.version_info` tuple to `(3, 9)`, so it was always False. The guarded
branch never ran. Remove the constant and keep only the branch that runs.

Assisted-by: ClaudeCode:claude-opus-5
2026-07-26 19:08:59 -07:00
Henry SchreinerandRalf W. Grosse-Kunstleve 57e7a8de34 fix(stl_bind): correct __delitem__ for negative-step slices and re-enable contiguous erase fast path (#6088)
* fix(stl_bind): correct __delitem__ for negative-step slices and re-enable contiguous erase fast path

The slice __delitem__ binding advanced the erase index by step - 1 for
all steps. That correction is only valid for positive steps, where
erasing shifts later elements down by one. For negative steps the
visited indices are strictly decreasing and erasing never shifts them,
so the extra -1 deleted the wrong elements (e.g. del v[::-2] on
[0,1,2,3] yielded [1,2] instead of [0,2]) and del v[::-1] walked off the
front of the vector (v.begin() - 1, observed SIGBUS).

Switch to the signed slice::compute overload so negative steps stay
signed, advance by step for negative steps and step - 1 for positive
ones, and drop the && false that had disabled the O(n) contiguous fast
path since 2016.

Assisted-by: ClaudeCode:claude-fable-5

* refactor: address review — static_cast and parametrized test

Use static_cast instead of a C-style cast for the slice.compute() size
argument, and convert the __delitem__ slice test to
pytest.mark.parametrize over the slice cases.

Assisted-by: ClaudeCode:claude-fable-5

* test(stl_bind): cover slice deletion edge cases

* fix(stl_bind): erase strided slices in descending order

* Eliminate a variable and avoid redundant index increment (i + 1, ++i).

The control flow handles all relevant boundaries:

- slicelength == 0: excluded by the outer guard.
- slicelength == 1: erases once, decrements to zero, and breaks without touching start.
- Larger slices: updates start exactly when another erase remains.
- slicelength cannot underflow because the loop exits when it reaches zero.
- Mutating slicelength is harmless because it is not used afterward.
- The potentially dangerous final start += step remains eliminated.

It also removes the separate loop counter. The compiler would probably
optimize the former i + 1, ++i mechanics away, but the new source expresses
the real state more directly: "number of erasures remaining."

The unconditional while (true) is safe because entry is strictly guarded by
slicelength > 0, and the decrement guarantees eventual termination.

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2026-07-26 03:14:56 -07:00
Henry Schreiner 36341ba9ba ci: test Python 3.15 (#6107) 2026-07-24 20:32:52 -04:00
Henry Schreiner fb836a2f1f ci: drop near-duplicate jobs (#6106)
Remove ten jobs whose coverage is already provided by other jobs:
duplicate ubuntu pypy/graalpy/3.11/3.14t runs, an intel-mac 3.11
smart_holder run, a windows job pinning the default MSVC runtime,
sandwiched clang 14 and gcc 10/C++20 entries, and extra win32 and
win32-debug variants. Also delete the gcc PYBIND11_TEST_OVERRIDE steps,
dead since gcc 12 left the matrix (the windows-2022 job still runs the
same exercise).

Assisted-by: ClaudeCode:claude-fable-5
2026-07-24 17:38:59 -04:00
Henry SchreinerandRalf W. Grosse-Kunstleve 85198b598f fix(ci): use the intended Python interpreter for CMake discovery (#6105)
* fix(ci): pin the discovered Python to the venv/setup-python interpreter

The manylinux/musllinux images added Python 3.15 and dropped 3.13t;
FindPython's version scan then picked /usr/local/bin/python3.15 over
the uv-created venv (Python_ROOT_DIR is only a hint). Similarly, the
macOS and Windows 3.14t jobs picked a system 3.14 over setup-python's
free-threaded interpreter. Pin the interpreter explicitly in both
places, and drop the 3.13t manylinux jobs.

Assisted-by: ClaudeCode:claude-fable-5

* ci: use setup-python's python-path output instead of a locate step

Assisted-by: ClaudeCode:claude-fable-5

* Apply suggestions from code review

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgkio@gmail.com>

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgkio@gmail.com>
2026-07-24 10:45:22 -04:00
Henry Schreiner 7478df9420 fix(cmake): unset stale PYTHON_MODULE_DEBUG_POSTFIX and correct USE_PYTHON_INCLUDE_DIR variable (#6086)
When the Python executable changes between CMake runs,
PYTHON_MODULE_DEBUG_POSTFIX was not being unset alongside PYTHON_IS_DEBUG
and PYTHON_MODULE_EXTENSION, allowing a stale postfix to survive interpreter
changes.

In the USE_PYTHON_INCLUDE_DIR block, the elseif branch checked
PYTHON_INCLUDE_DIR (singular) but expanded PYTHON_INCLUDE_DIRS (plural),
always silently resolving to an empty string. Correct it to expand
${PYTHON_INCLUDE_DIR}. Also add a Python3_INCLUDE_DIRS branch so the
option works when pybind11NewTools resolves Python via the Python3
find-package component.

Assisted-by: ClaudeCode:claude-fable-5
2026-07-23 01:40:11 -04:00
Henry Schreiner 28b98f2d39 ci: update cibuildwheel to v4.1 and pyodide to 314 (#6095)
* ci: update cibuildwheel to v4.1 and pyodide to 314

Bump pypa/cibuildwheel from v3.4 to v4.1 across the Pyodide, iOS, and
Android jobs. Move the Pyodide build to cp314-pyodide_wasm32
(pyodide 314.0.0).

Drop the iOS CIBW_SKIP: cp314-* workaround now that pypa/cibuildwheel#2494
is resolved.

Assisted-by: ClaudeCode:claude-opus-4.8

* test: xfail array resize on numpy<2.4 + Python 3.14

Removing the cp314 iOS skip surfaced a pre-existing numpy bug, not a
cibuildwheel regression: numpy<2.4 has a resize(refcheck=True) regression
on Python 3.14 where the reference held by the bound function isn't
detected, so a resize that should raise instead succeeds and the later
reshape rejects the non-square size. Fixed in numpy>=2.4, but the iOS test
environment has no numpy wheel newer than 2.3.5.post1, so xfail the test
for that specific combination.

Assisted-by: ClaudeCode:claude-opus-4.8

* test: link numpy resize aliasing issue and trim comment

iOS numpy wheels updated to 2.5.0, so the xfail is a general numpy<2.4 +
Python 3.14 guard rather than iOS-specific. Reference numpy/numpy#30265.

Assisted-by: ClaudeCode:claude-opus-4.8
2026-07-08 23:31:36 -04:00
Henry Schreiner db92ad940f revert: "add life support to handles cast to string_view (#6092)" (#6097)
This reverts commit 59d7cb28c1 (#6092).

#6092 introduced regressions that are being addressed in #6096; reverting

Assisted-by: ClaudeCode:claude-opus-4.8
2026-06-29 00:38:56 -04:00
Henry Schreiner 84da0e2545 refactor: remove needless load_src alias in string_caster (#6093)
`load_src` was a Python 2-era leftover. A removed branch used to reassign
it to a temporary unicode object; since that was deleted with Python 2
support, it is now an exact, never-reassigned alias of `src`. Use `src`
directly.

Spotted in review of #6092.

Assisted-by: ClaudeCode:claude-opus-4.8
2026-06-23 21:15:58 -07:00
Henry SchreinerandRalf W. Grosse-Kunstleve 3de0402476 chore: add agent files (#6082)
* chore: add agent files

Assisted-by: ClaudeCode:claude-opus-4.8
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>

* fix: better AGENTS.md

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>

* Apply suggestions from code review

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgkio@gmail.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgkio@gmail.com>
2026-06-23 23:49:20 -04:00
Henry Schreiner 085b66068a fix: data race on last_storage_ptr_ cache in gil_safe_call_once_and_store (#6087)
Under free-threaded CPython (Py_GIL_DISABLED) the GIL provides no mutual
exclusion, so the plain pointer last_storage_ptr_ was read and written
concurrently without synchronization, a C++ data race. Make it a
std::atomic<T *>.

Also reorder get_stored() to check is_last_storage_valid() before loading
the cached pointer. The writer publishes the pointer before setting the
validity flag, so the flag must be observed first for correct
acquire/release ordering.

Assisted-by: ClaudeCode:claude-fable-5
2026-06-23 21:48:26 -04:00
Henry Schreiner da3bdcad04 chore(setup_helpers): remove dead cpp_flag_cache and fix parameter typo (#6085)
Remove the module-level `cpp_flag_cache = None` variable and its stale
comment "Every call will cache the result". The actual caching is handled
by the `@lru_cache` decorator on `auto_cpp_level` directly below.

Also rename the typo'd parameter `obg` to `obj` in `no_recompile`.
Nothing passes this argument by keyword, so there is no API break.

Part of #6084

Assisted-by: ClaudeCode:claude-sonnet-4-6
2026-06-17 08:16:49 -04:00
Henry Schreiner 99117da020 chore(eval): drop Python 2 coding cookie prepended to evaluated source (#6089)
The `# -*- coding: utf-8 -*-` line prepended to every string passed to
PyRun_String was a Python 2 workaround. Python 3's PyRun_String already
assumes UTF-8 source encoding, so the cookie is dead weight — and
harmful: it shifts all line numbers up by one in tracebacks and
SyntaxErrors from evaluated code (a `raise` on line 2 would incorrectly
appear as line 3).

Remove the cookie and replace the stale comment with one that explains
the actual reason for the `std::string` conversion (need a C string for
PyRun_String). No other location in eval.h uses this pattern
(eval_file reads directly from a FILE*).

Assisted-by: ClaudeCode:claude-fable-5
2026-06-17 08:16:04 -04:00
Henry Schreiner f00aa6fe07 ci: drop boost from 32-bit mingw32 install (#6091)
* ci: drop boost from 32-bit mingw32 install

MSYS2 removed the mingw-w64-i686-boost package (32-bit i686 is being
phased out), so the mingw32 matrix entry now fails at the pacman install
step with "target not found: mingw-w64-i686-boost". Boost is optional
test coverage (boost::optional / boost::variant casters, gated behind
PYBIND11_TEST_BOOST); without it those tests are skipped and the rest of
the job builds and runs normally. Move boost to the mingw64 extra_install
so the 64-bit job keeps that coverage.

Assisted-by: ClaudeCode:claude-opus-4.8

* Apply suggestion from @henryiii
2026-06-17 08:13:47 -04:00
Henry Schreiner ff1a35cb84 ci: update GraalPy from 24.2 to 25.0 (Python 3.12 based) (#6083)
* ci: update GraalPy from 24.2 to 25.0 (Python 3.12 based)

- Replace graalpy-24.2 with graalpy-25.0 in CI matrix
- Replace graalpy-24.1 with graalpy-24.2 (shift older version up)
- Remove dead GRAALPY_VERSION < (24, 2) xfail guards from tests
- Remove unused GRAALPY_VERSION from tests/env.py
- Update internals.h comment to reference v25.0

Assisted-by: OpenCode:glm-5

* fix: use numpy 2.2.x for GraalPy 3.12 (graalpy312 wheels)

numpy 1.26.x only has graalpy311 wheels; GraalPy 25.0 (Python 3.12)
requires numpy 2.2.x which has graalpy312 wheels on the GraalVM index.

Assisted-by: OpenCode:glm-5

* fix: simplify numpy requirement for GraalPy (drop 3.11 branch)

We no longer test GraalPy 3.11, so the version split is unnecessary.

Assisted-by: OpenCode:glm-5
2026-06-10 16:03:38 -04:00
Henry Schreiner 288913638b ci: bump setup-uv to maintained tag scheme (#6035)
The old vX tags have been dropped to (force) (usually) better security practices. Dependabot will not update, however, leaving this v7 tag forever. Manually updating now.

See https://github.com/astral-sh/setup-uv/issues/830

Committed via https://github.com/asottile/all-repos
2026-04-11 22:45:57 -07:00
Henry Schreiner 1c72409f7f chore: some minor CPython API cleanup (#6005)
* chore: use PyType_GetFlags

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>

* chore: use public VectorCall in 3.9+

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>

---------

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
2026-03-22 14:27:20 -07:00
Henry Schreiner e44aae2268 chore: bump CMake max policy to 4.2 (#5944)
* chore: bupm CMake to 4.1

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>

* ci: use newest version of CMake in a few places

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>

* chore: bupm CMake to 4.2

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>

---------

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
2026-01-15 12:38:45 -05:00
Henry SchreinerandRalf W. Grosse-Kunstleve 1006933415 chore: also use typos (#5931)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2025-12-13 02:17:08 -08:00
Henry Schreiner 1ccaad5b12 chore: log_level is better than log_cli_level (#5890) 2025-11-10 20:28:09 -08:00
Henry Schreiner 6e0d1c2400 chore: back to work
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-08-22 16:08:51 -04:00
Henry Schreiner f5fbe867d2 chore: bump to 3.0.1 (#5810)
* docs: prepare for 3.0.1

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* chore: bump for 3.0.1

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update docs/changelog.md

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-08-22 15:57:09 -04:00
Henry Schreiner cddec2bb1d fix: limit warning issue (#5807)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-08-21 16:07:26 -04:00
Henry Schreiner e71489c314 tests: avoid false DOWNLOAD_CATCH manually-specified variables warning (#5803)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-08-21 15:52:09 -04:00
Henry Schreiner adb5603f60 chore: rename generic slots variable (#5793)
* fix: better compatibility with Qt

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

style: pre-commit fixes

* refactor: use mod_def_slots as a name instead

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-08-21 11:06:30 -04:00
Henry Schreiner ce7122857a ci: avoid macOS 15 image change for iOS (#5798) 2025-08-16 09:12:00 -04:00
Henry SchreinerandMalcolm Smith 23c59b6e3d ci: add android test (#5714)
* ci: add android test

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Fix Android tests (#23)

* Android tests working

* Clarifications

* ci: only use fork on Android

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* ci: add wheel (missing)

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* ci: no patchelf?

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* ci: forgot pyproject android mention

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Fix GHA configuration

* Update to cibuildwheel 3.1

* Restore installation of "wheel"

* Revert iOS to cibuildwheel 3.0

* Actually revert iOS back to cibuildwheel 3.0

* Restore iOS to cibuildwheel 3.1, and skip Python 3.14 instead

* Update .github/workflows/tests-cibw.yml

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Malcolm Smith <smith@chaquo.com>
2025-08-06 22:32:45 -04:00
Henry Schreiner 6972597c9b docs: show nogil in most examples (#5770)
Created using [mini-swe-agent](https://mini-swe-agent.com) and the propmt:

I'd like to find usages of PYBIND11_MODULE in the docs folder and add py::mod_gil_not_used() as a third argument if there ar
e only two arguments. These are examples, and it's really a good idea to always include that now.

I removed a few of the changes.

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-07-27 23:08:11 -06:00
Henry Schreiner 66d394f259 docs: standardize header a bit (#5749) 2025-07-11 13:51:17 -07:00
Henry Schreiner 03d8f48750 docs: fix typo in multiple_interpreters (#5738)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-06-19 11:46:03 -04:00
Henry Schreiner ea3e33e40d chore: prepare for 3.0.0rc4 (#5736)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-06-19 10:51:52 -04:00
Henry Schreiner cf3d1a75a2 feat: numpy scalars (#5726) 2025-06-18 19:40:31 -04:00
Henry Schreiner be507b725b ci: check latest on 3.13 (#5734)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-06-18 11:34:50 -04:00
Henry Schreiner ad9180c120 fix: android CMake support (#5733) 2025-06-17 20:04:52 -04:00
Henry Schreiner d218b160a6 ci: avoid 3.13.4 on Windows (#5725) 2025-06-13 18:46:07 -04:00
Henry Schreiner 513d1f962e ci: check iOS update (#5717) 2025-06-10 17:36:09 -04:00
Henry Schreiner 5d32ed76c0 docs: prepare for RC 3 (#5713)
* docs: prepare for RC 3

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* docs: one more rc 3 update

* chore: bump to 3.0.0rc3

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-06-05 11:14:33 -04:00
Henry Schreiner d4d2ec1ad8 ci: avoid brownout (and removal) of windows-2019 (#5712)
* ci: avoid brownout (and removal) of windows-2019

* Drop 2019 or update to 2022/latest
2025-06-03 13:06:20 -04:00
Henry Schreinerandpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> 9295c4a568 fix: follow rest of pybind11 closer with PYBIND11_HAS_SUBINTERPRETER_SUPPORT (#5710)
* fix: follow rest of pybind11 closer with PYBIND11_HAS_SUBINTERPRETER_SUPPORT

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* style: pre-commit fixes

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-06-02 16:08:40 -04:00
Henry Schreiner 7da1d53df5 ci: test on iOS (#5705)
* ci: add iOS

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update .github/workflows/tests-cibw.yml

* ci: use test groups

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-06-02 00:29:40 -04:00
Henry Schreiner 21c9dd11bc ci: drop main tests on main
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-31 15:44:42 -04:00
Henry Schreiner e4873e8f59 fix: allow subinterp support to be disabled
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-31 15:44:42 -04:00
Henry Schreiner 33fb53335e fix: C++20 in Windows
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

style: pre-commit fixes
2025-05-30 18:30:25 -04:00
Henry Schreiner bc557a9b5b tests: add PYBIND11_TEST_SMART_HOLDER to tests
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-30 18:30:25 -04:00
Henry Schreiner 29979761ba ci: rename cibw workflow file
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-30 18:30:25 -04:00
Henry Schreiner 7e672ca106 tests: support C++23 in tests
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-30 18:30:25 -04:00
Henry Schreiner ef2ad42d2d ci: list all jobs explicitly
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-30 18:30:25 -04:00
Henry Schreiner 5dff3354fc ci: reduce runs on draft PRs
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

Update ci.yml
2025-05-30 18:30:25 -04:00
Henry Schreiner df595b1657 docs: changelog update for 3.0.0rc2
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-29 11:05:00 -04:00
Henry Schreiner a1b1972241 chore: prepare for 3.0.0rc2 (#5698)
* chore: prepare for 3.0.0rc2

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update docs/changelog.md

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-29 01:16:32 -04:00
Henry Schreinerandpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> a18b1bc4dc tests: always disable on the nogil build (#5701)
* docs: fix docs on visibilty preset hidden

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: always disable on the nogil build

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* style: pre-commit fixes

* docs: mention skip reason in comment

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-28 23:33:53 -04:00
Henry Schreinerandpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> 57e27c1ffc tests: skip some flaky gil tests on nogil (#5699)
* tests: skip some flaky gil tests on nogil

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update test_gil_scoped.py

* style: pre-commit fixes

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-27 11:22:35 -04:00
Henry Schreiner 1c10d5e9b1 fix: prepare for 3.14 beta 2 (#5697)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-27 00:05:19 -04:00
Henry Schreiner 6e3e8515e7 fix(cmake): regression in include gaurd (#5691)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-26 12:26:08 -04:00
Henry Schreiner 1dd85ef42a chore: bump maximum clang tested to 20 (#5692) 2025-05-25 10:54:05 -04:00
Henry SchreinerandRalf W. Grosse-Kunstleve 9d06626521 docs: more warnings about locking and the GIL (#5689)
* docs: more warnings about locking and the GIL

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix require → reacquire typo

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgkio@gmail.com>
2025-05-24 19:12:49 -04:00
Henry Schreinerandpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> d7769de533 feat: scoped_critical_section (#5684)
* feat: scoped_critical_section

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* refactor: pull out to file

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* style: pre-commit fixes

* fix: GIL code in some compilers

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: move to correct spot

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-23 17:41:45 -04:00
Henry Schreiner e4622cbd7b chore(cmake): add compile commands to preset (#5685)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-23 15:13:37 -04:00
Henry Schreiner 8d503e30be docs: update contributing/release guide a little (#5681)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-22 01:38:10 -04:00
Henry SchreinerandRalf W. Grosse-Kunstleve 2624d4a360 tests: expect free-threaded import warnings (#5680)
* tests: expect free-threaded import warnings

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update tests/test_cpp_conduit.py

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgkio@gmail.com>

* Update tests/test_cpp_conduit.py

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgkio@gmail.com>
2025-05-22 01:37:57 -04:00
Henry SchreinerandCopilot fc888f758f docs: prepare for 3.0.0rc1 (#5679)
* docs: prepare for 3.0.0rc1

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update changelog.md

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-21 14:14:27 -04:00
Henry Schreiner e8f16e2fdd docs: remove setup.py mentions, mention presets (#5677)
* docs: remove setup.py mentions, mention presets

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update .github/CONTRIBUTING.md

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-20 19:02:41 -04:00
Henry Schreinerandpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> ec8b050824 chore: convert changelog to markdown (#5672)
* chore: move changelog to markdown

* chore: switch to simpler block def

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* style: pre-commit fixes

* chore: handle more block ends

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* docs: fix md display

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* docs: one more fix

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* style: pre-commit fixes

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-20 14:52:14 -04:00
Henry Schreiner e625668439 fix(cmake): error wasn't triggering (#5676)
* fix(cmake): error wasn't triggering

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix(cmake): wrong name of option

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-20 12:30:40 -04:00
Henry SchreinerandCopilot 7319402a9f chore: show preview on docs changes (#5673)
* chore: show preview on docs changes

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update .github/workflows/docs-link.yml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-20 10:44:55 -04:00
Henry Schreiner 3867c5f5a8 ci: add nightlies for scientific-python (#5675)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-20 10:42:14 -04:00
Henry Schreiner cc86e8b2a6 fix(cmake): better --fresh support (#5668)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-18 21:12:12 -04:00
Henry Schreinerandpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> 094343c74a fix: support Python 3.14 (#5646)
* ci: support Python 3.14

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: Python 3.14 name change

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: fix expected output to handle Python 3.14

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: tighten CLI and add color on 3.14+

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: ignore failure on 3.14.0b1

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: support Python 3.14.0b1 with interperters

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update test_multiple_interpreters.py

* Update test_multiple_interpreters.py

* fix: new breakage for 3.14 fixed

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: handle empty annotations 3.14

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: Python 3.14 may not create the annotations dict

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: use PyUnstable_IsImmortal

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: use sys._is_immortal

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: ignore large values for refcount too

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* style: pre-commit fixes

* ci: enable all free-threaded builds

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: patch for embed

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Revert "fix: patch for embed"

This reverts commit c4226a0671.

* ci: drop new 3.xt additions

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: logic issue, also add some comments

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update include/pybind11/pytypes.h

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-16 21:58:43 -04:00
Henry Schreiner af231a6054 chore: use scikit-build-core for the build (#5598)
* chore: use scikit-build-core for the build

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: support tests job

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* refactor: use tomlkit instead of manual parsing

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: add tests for output

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* chore: remove more unused files

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: restore global pin

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: test and fix pinning

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-15 14:39:23 -04:00
Henry SchreinerandCopilot 05a6a03e7d chore(cmake): add CMake presets (#5655)
* chore(cmake): add CMake presets

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update .github/workflows/ci.yml

* fix: don't autodetect `.venv` if inside a VIRTUALENV already

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update CMakeLists.txt

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-14 01:29:24 -04:00
Henry Schreiner 853bafa0a2 fix: use original dict (#5658)
* fix: use original dict

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* refactor: handle unset dict just in case

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-13 14:09:05 -04:00
Henry Schreiner c5dc6f9fb7 ci: bump default versions (#5657)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-13 10:08:34 -04:00
Henry Schreiner ce42c4df48 fix(cmake): avoid message if FINDPYTHON NEW (#5656)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-13 00:44:25 -04:00
Henry Schreiner d7d782c5e0 fix(regression): support embedded submodule (#5650)
* tests: add test for embedded submodule

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: adjust

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update test_interpreter.cpp

* Update test_interpreter.cpp

* Update test_interpreter.cpp

* Update test_interpreter.cpp

* Update pybind11.h

* fix: end instead of endif

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update include/pybind11/pybind11.h

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-12 05:32:36 -04:00
Henry Schreiner b3bb31ca51 ci: work on speeding up further (#5613)
* ci: work on speeding up further

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* chore: move uv's index-strategy to pyproject.toml

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update .github/workflows/ci.yml

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-04-14 17:25:32 -04:00
Henry Schreiner 662a88cbc1 ci: speed up ci a bit by thinning out matrix (#5602)
* ci: speed up ci a bit by thinning out matrix

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update configure.yml

* Update configure.yml

* Update configure.yml

* ci: drop third build

* ci: fix minor issues

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* ci: trim a bit more

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-04-10 23:21:57 -04:00
Henry Schreiner d25e91fb8f fix(cmake): warning about missing file (#5612)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-04-10 17:48:16 -04:00
Henry Schreiner 6d1f28fe2b feat: remove make_simple_namespace (#5597)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-04-08 23:44:18 -04:00
Henry Schreiner 73ad3099fb fix: fully deprecate get_type_of (deprecated in 2.6 but no warning (#5596)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-04-08 23:43:49 -04:00
Henry Schreiner b70b8eb332 chore: require pytest 6 consistently (#5599)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-04-04 12:35:55 -07:00
Henry SchreinerandRalf W. Grosse-Kunstleve fdab860a32 feat: drop PYBIND11_NUMPY_1_ONLY (#5595)
* feat: drop PYBIND11_NUMPY_1_ONLY

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Add #error "PYBIND11_NUMPY_1_ONLY is no longer supported." in pybind11/numpy.h

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2025-04-03 22:08:56 -04:00
Henry Schreiner 55b1357d8e chore: update nox and test deps (#5594)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-04-02 08:24:15 -04:00
Henry Schreiner 8ef10a0ec9 ci: update to GraalPy 24.2 and mention in README (#5586)
* ci: update to GraalPy 24.2 and mention in README

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: update for GRAALPY 24.2 and better printout

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: use __graalpython__ for version number

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update README.rst

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-03-31 22:50:55 -04:00
Henry Schreiner d27fdaa272 chore: update for CMake 4.0 (#5593)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-03-31 22:50:40 -04:00
Henry SchreinerandRalf W. Grosse-Kunstleve 8f00d1eea0 fix: set __file__ on submodules (#5584)
* fix: set __file__ on submodules

The docs state ['The caller is responsible for setting a `__file__` attribute'](https://docs.python.org/3/c-api/module.html), but we
were not doing that, which interferes with pickling objects in submodules using cloudpickle. Users previously had to set the `__file__` attributes manually,
such as in https://github.com/scikit-hep/boost-histogram/blob/1fbbe1632e1665863b9c84b10edf6aa659a14bf1/src/boost_histogram/histogram.py#L83-L90.

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: support GraalPy

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: workaround only for GraalPython

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Add GRAALPY_VERSION_NUM to GraalPy workaround

* Fix "GRAALPY_VERSION_NUM not defined" issue

```
/Users/runner/work/pybind11/pybind11/include/pybind11/pybind11.h:1340:32: error: 'GRAALPY_VERSION_NUM' is not defined, evaluates to 0 [-Werror,-Wundef]
                               ^
```

Related ChatGPT conversation: https://chatgpt.com/share/67e6cb99-84b0-8008-99d6-aadc70242cf3

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2025-03-28 09:57:39 -07:00
Henry Schreiner bb504dd809 fix: FindPython by default logic error (#5561)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-03-20 17:38:30 -04:00
Henry Schreiner 655c60d84c docs: fix incorrect name (PYBIND11_NEWPYTHON) (#5570) 2025-03-19 12:45:26 -04:00