mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-19 22:39:09 +00:00
feat(typing): allow annotate methods with pos_only when only have the self argument (#5403)
* feat: allow annotate methods with `pos_only` when only have the `self` argument * chore(typing): make arguments for auto-generated dunder methods positional-only * docs: add more comments to improve readability * style: fix nit suggestions * Add test_self_only_pos_only() in tests/test_methods_and_attributes * test: add docstring tests for generated dunder methods * test: remove failed tests * fix(test): run `gc.collect()` three times for refcount tests --------- Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
This commit is contained in:
@@ -294,7 +294,7 @@ TEST_SUBMODULE(methods_and_attributes, m) {
|
||||
static_cast<py::str (ExampleMandA::*)(int, int)>(
|
||||
&ExampleMandA::overloaded));
|
||||
})
|
||||
.def("__str__", &ExampleMandA::toString)
|
||||
.def("__str__", &ExampleMandA::toString, py::pos_only())
|
||||
.def_readwrite("value", &ExampleMandA::value);
|
||||
|
||||
// test_copy_method
|
||||
|
||||
Reference in New Issue
Block a user