| 1926 | } |
| 1927 | |
| 1928 | static int init(PObject* self, PyObject* args, PyObject* kwargs) |
| 1929 | { |
| 1930 | return handleExc([&]() -> int |
| 1931 | { |
| 1932 | using InitArgs = typename Ty::_InitArgs; |
| 1933 | if constexpr (std::tuple_size_v<InitArgs> == 0) |
| 1934 | { |
| 1935 | if (args && PyTuple_Size(args) != 0) |
| 1936 | { |
| 1937 | throw TypeError{ "function takes " + std::to_string(std::tuple_size_v<InitArgs>) + " arguments (" + std::to_string(PyTuple_Size(args)) + " given)" }; |
| 1938 | } |
| 1939 | } |
| 1940 | |
| 1941 | if (std::tuple_size_v<InitArgs> != PyTuple_Size(args)) |
| 1942 | { |
| 1943 | throw TypeError{ "function takes " + std::to_string(std::tuple_size_v<InitArgs>) + " arguments (" + std::to_string(PyTuple_Size(args)) + " given)" }; |
| 1944 | } |
| 1945 | if (kwargs) |
| 1946 | { |
| 1947 | throw TypeError{ "function takes positional arguments only" }; |
| 1948 | } |
| 1949 | |
| 1950 | initFromPython<InitArgs>(self, args, std::make_index_sequence<std::tuple_size_v<InitArgs>>{}); |
| 1951 | return 0; |
| 1952 | }); |
| 1953 | } |
| 1954 | |
| 1955 | friend class TypeWrapper<PObject<Ty>>; |
| 1956 | }; |
nothing calls this directly
no test coverage detected