Skip to content

Commit 456e214

Browse files
committed
Minimal reproducer for breakage introduced by PR #3402.
1 parent 72282f7 commit 456e214

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

tests/test_kwargs_and_defaults.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,12 @@ TEST_SUBMODULE(kwargs_and_defaults, m) {
167167
"class_default_argument",
168168
[](py::object a) { return py::repr(std::move(a)); },
169169
"a"_a = py::module_::import("decimal").attr("Decimal"));
170+
171+
// https://github.com/pybind/pybind11/pull/3402#issuecomment-963341987
172+
// Reduced from tensorstore.Dim
173+
struct tensorstore_dim {};
174+
py::class_<tensorstore_dim>(m, "tensorstore_dim")
175+
.def(py::init([](int) { return tensorstore_dim(); }),
176+
py::kw_only(), // test_tensorstore_dim passes with this line commented out.
177+
py::arg("i") = 0);
170178
}

tests/test_kwargs_and_defaults.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,3 +370,7 @@ def test_args_refcount():
370370
assert m.mixed_args_refcount(myval, myval, myval) == (exp3 + 3, exp3 + 3, exp3 + 3)
371371

372372
assert m.class_default_argument() == "<class 'decimal.Decimal'>"
373+
374+
375+
def test_tensorstore_dim():
376+
m.tensorstore_dim(i=1)

0 commit comments

Comments
 (0)