From 114bfeb762e623330b3f1efa9d53b090782e7765 Mon Sep 17 00:00:00 2001 From: Yung-Yu Chen Date: Wed, 25 May 2016 20:54:12 +0800 Subject: [PATCH] pybind11::args should have been derived from tuple args was derived from list, but cpp_function::dispatcher sends a tuple to it->impl (line #346 and #392 in pybind11.h). As a result args::size() and args::operator[] don't work at all. On my mac args::size() returns -1. Making args a subclass of tuple fixes it. --- example/example11.cpp | 4 ++-- include/pybind11/pytypes.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example/example11.cpp b/example/example11.cpp index 466eed465..799fa6226 100644 --- a/example/example11.cpp +++ b/example/example11.cpp @@ -27,8 +27,8 @@ py::object call_kw_func(py::function f) { } void args_function(py::args args) { - for (auto item : args) - std::cout << "got argument: " << item << std::endl; + for (size_t it=0; it