Skip to content

test: reject shared_ptr casts for custom holders#6069

Merged
rwgk merged 2 commits into
pybind:masterfrom
rwgk:test_issue6064_unsafe_path_remains_rejected
May 19, 2026
Merged

test: reject shared_ptr casts for custom holders#6069
rwgk merged 2 commits into
pybind:masterfrom
rwgk:test_issue6064_unsafe_path_remains_rejected

Conversation

@rwgk
Copy link
Copy Markdown
Collaborator

@rwgk rwgk commented May 18, 2026

Description

Closes #6064

Lock down the current behavior discussed in issue #6064: py::cast() from std::shared_ptr<T> remains rejected for custom holder bindings that are not std::shared_ptr or py::smart_holder.

This extracts the incompatible-holder coverage from PR #6068 and adds a test shaped like issue #6064.

See also: PR #6065, PR #6066

Suggested changelog entry:

  • N/A

Lock down the current behavior discussed in issue pybind#6064: py::cast() from std::shared_ptr<T> remains rejected for custom holder bindings that are not std::shared_ptr or py::smart_holder.

This extracts the incompatible-holder coverage from PR pybind#6068 and adds a test shaped like issue pybind#6064, while PR pybind#6065 and PR pybind#6066 explore alternative support paths.
@rwgk rwgk requested a review from virtuald May 18, 2026 19:23
@rwgk rwgk merged commit 28bbda9 into pybind:master May 19, 2026
88 checks passed
@github-actions github-actions Bot added the needs changelog Possibly needs a changelog entry label May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs changelog Possibly needs a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: py::cast() from std::shared_ptr throws with custom holder

2 participants