mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
fix: Reject keyword argument None with .none(false) (#2611)
* demo kwarg with none(false) * Reorder and extend tests for arg::none(false) in test_methods_and_attributes.py::test_accepts_none * Fix arg::none() for keyword arguments * Add changelog note * Fix names of no_none_kw test functions Co-authored-by: Yannick Jadoul <yannick.jadoul@belgacom.net>
This commit is contained in:
committed by
GitHub
parent
7f9445a626
commit
6edd0e6d90
@@ -336,6 +336,9 @@ TEST_SUBMODULE(methods_and_attributes, m) {
|
||||
m.def("ok_none4", &none4, py::arg().none(true));
|
||||
m.def("ok_none5", &none5);
|
||||
|
||||
m.def("no_none_kwarg", &none2, py::arg("a").none(false));
|
||||
m.def("no_none_kwarg_kw_only", &none2, py::kw_only(), py::arg("a").none(false));
|
||||
|
||||
// test_str_issue
|
||||
// Issue #283: __str__ called on uninitialized instance when constructor arguments invalid
|
||||
py::class_<StrIssue>(m, "StrIssue")
|
||||
|
||||
Reference in New Issue
Block a user