mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-13 17:13:53 +00:00
2686da8350
This commit rewrites the function dispatcher code to support mixing regular arguments with py::args/py::kwargs arguments. It also simplifies the argument loader noticeably as it no longer has to worry about args/kwargs: all of that is now sorted out in the dispatcher, which now simply appends a tuple/dict if the function takes py::args/py::kwargs, then passes all the arguments in a vector. When the argument loader hit a py::args or py::kwargs, it doesn't do anything special: it just calls the appropriate type_caster just like it does for any other argument (thus removing the previous special cases for args/kwargs). Switching to passing arguments in a single std::vector instead of a pair of tuples also makes things simpler, both in the dispatch and the argument_loader: since this argument list is strictly pybind-internal (i.e. it never goes to Python) we have no particular reason to use a Python tuple here. Some (intentional) restrictions: - you may not bind a function that has args/kwargs somewhere other than the end (this somewhat matches Python, and keeps the dispatch code a little cleaner by being able to not worry about where to inject the args/kwargs in the argument list). - If you specify an argument both positionally and via a keyword argument, you get a TypeError alerting you to this (as you do in Python). |
||
---|---|---|
.. | ||
_static | ||
advanced | ||
basics.rst | ||
benchmark.py | ||
benchmark.rst | ||
changelog.rst | ||
classes.rst | ||
compiling.rst | ||
conf.py | ||
Doxyfile | ||
environment.yml | ||
faq.rst | ||
index.rst | ||
intro.rst | ||
limitations.rst | ||
Makefile | ||
pybind11_vs_boost_python1.png | ||
pybind11_vs_boost_python1.svg | ||
pybind11_vs_boost_python2.png | ||
pybind11_vs_boost_python2.svg | ||
pybind11-logo.png | ||
reference.rst | ||
release.rst |