Skip to content

Commit 08eb4ff

Browse files
committed
Remove superseded handle::operator() overloads
The variadic handle::operator() offers the same functionality as well as mixed positional, keyword, * and ** arguments. The tests are also superseded by the ones in `test_callbacks`.
1 parent fa4b4e8 commit 08eb4ff

File tree

4 files changed

+2
-30
lines changed

4 files changed

+2
-30
lines changed

include/pybind11/cast.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,20 +1133,6 @@ template <return_value_policy policy,
11331133
return operator()<policy>(std::forward<Args>(args)...);
11341134
}
11351135

1136-
inline object handle::operator()(detail::args_proxy args) const {
1137-
object result(PyObject_CallObject(m_ptr, args.ptr()), false);
1138-
if (!result)
1139-
throw error_already_set();
1140-
return result;
1141-
}
1142-
1143-
inline object handle::operator()(detail::args_proxy args, detail::kwargs_proxy kwargs) const {
1144-
object result(PyObject_Call(m_ptr, args.ptr(), kwargs.ptr()), false);
1145-
if (!result)
1146-
throw error_already_set();
1147-
return result;
1148-
}
1149-
11501136
template <typename... Args, typename /*SFINAE*/>
11511137
dict::dict(Args &&...args)
11521138
: dict(detail::unpacking_collector<>(std::forward<Args>(args)...).kwargs()) { }

include/pybind11/pytypes.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ class handle {
4848
object call(Args&&... args) const;
4949
template <return_value_policy policy = return_value_policy::automatic_reference, typename ... Args>
5050
object operator()(Args&&... args) const;
51-
inline object operator()(detail::args_proxy args) const;
52-
inline object operator()(detail::args_proxy f_args, detail::kwargs_proxy kwargs) const;
5351
operator bool() const { return m_ptr != nullptr; }
5452
bool operator==(const handle &h) const { return m_ptr == h.m_ptr; }
5553
bool operator!=(const handle &h) const { return m_ptr != h.m_ptr; }

tests/test_kwargs_and_defaults.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@ std::string kw_func4(const std::vector<int> &entries) {
2020
return ret;
2121
}
2222

23-
py::object call_kw_func(py::function f) {
24-
py::tuple args = py::make_tuple(1234);
25-
py::dict kwargs;
26-
kwargs["y"] = py::cast(5678);
27-
return f(*args, **kwargs);
28-
}
29-
3023
py::tuple args_function(py::args args) {
3124
return args;
3225
}
@@ -49,9 +42,7 @@ test_initializer arg_keywords_and_defaults([](py::module &m) {
4942
std::vector<int> list;
5043
list.push_back(13);
5144
list.push_back(17);
52-
5345
m.def("kw_func4", &kw_func4, py::arg("myList") = list);
54-
m.def("call_kw_func", &call_kw_func);
5546

5647
m.def("args_function", &args_function);
5748
m.def("args_kwargs_function", &args_kwargs_function);

tests/test_kwargs_and_defaults.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import pytest
2-
from pybind11_tests import (kw_func0, kw_func1, kw_func2, kw_func3, kw_func4, call_kw_func,
3-
args_function, args_kwargs_function, kw_func_udl, kw_func_udl_z,
4-
KWClass)
2+
from pybind11_tests import (kw_func0, kw_func1, kw_func2, kw_func3, kw_func4, args_function,
3+
args_kwargs_function, kw_func_udl, kw_func_udl_z, KWClass)
54

65

76
def test_function_signatures(doc):
@@ -49,8 +48,6 @@ def test_named_arguments(msg):
4948

5049

5150
def test_arg_and_kwargs():
52-
assert call_kw_func(kw_func2) == "x=1234, y=5678"
53-
5451
args = 'arg1_value', 'arg2_value', 3
5552
assert args_function(*args) == args
5653

0 commit comments

Comments
 (0)