pybind / pybind11

Seamless operability between C++11 and Python
https://pybind11.readthedocs.io/
Other
15.09k stars 2.05k forks source link

feat(types) Adds special Case for empty C++ tuple type annotation #5214

Closed InvincibleRMC closed 2 days ago

InvincibleRMC commented 2 days ago

Description

Split off from #5212

Due to how tuple_caster implements it's type generation it works for all tuples except the empty tuple which previously generated tuple[] rather than the correct tuple[()]

https://github.com/pybind/pybind11/blob/51c2aa16de5b50fe4be6a0016d6090d4a831899e/include/pybind11/cast.h#L675-L677

Suggested changelog entry:

   Adds Special type annotation for C++ empty tuple.