• Dean Moldovan's avatar
    Make TypeErrors more informative when an optional header is missing · 2b4477eb
    Dean Moldovan authored
    E.g. trying to convert a `list` to a `std::vector<int>` without
    including <pybind11/stl.h> will now raise an error with a note that
    suggests checking the headers.
    
    The note is only appended if `std::` is found in the function
    signature. This should only be the case when a header is missing.
    E.g. when stl.h is included, the signature would contain `List[int]`
    instead of `std::vector<int>` while using stl_bind.h would produce
    something like `MyVector`. Similarly for `std::map`/`Dict`, `complex`,
    `std::function`/`Callable`, etc.
    
    There's a possibility for false positives, but it's pretty low.
    2b4477eb
pybind11_cross_module_tests.cpp 5.16 KB