1. Apr 14, 2020
    • Ralf W. Grosse-Kunstleve's avatar
      Allows users to specialize polymorphic_type_hook with std::enable_if. · 4697149d
      Ralf W. Grosse-Kunstleve authored
      Currently user specializations of the form
      
      template <typename itype> struct polymorphic_type_hook<itype, std::enable_if_t<...>> { ... };
      
      will fail if itype is also polymorphic, because the existing specialization will also
      be enabled, which leads to 2 equally viable candidates. With this change, user provided
      specializations have higher priority than the built in specialization for polymorphic types.
      4697149d
  2. Mar 31, 2020
  3. Mar 04, 2020
  4. Jan 22, 2020
  5. Jan 17, 2020
  6. Jan 05, 2020
  7. Jan 03, 2020
    • Wenzel Jakob's avatar
      Handle cases where binding code immediately throws py::error_already_set · bf2b0314
      Wenzel Jakob authored
      When binding code immediately throws an exception of type
      py::error_already_set (e.g. via py::module::import that fails), the
      catch block sets an import error as expected. Unfortunately, following
      this, the deconstructor of py::error_already_set decides to call
      py::detail::get_internals() and set up various internal data structures
      of pybind11, which fails given that the error flag is active. The call
      stack of this looks as follows:
      
      Py_init_mymodule() -> __cxa_decrement_exception_refcount ->
      error_already_set::~error_already_set() ->
      gil_scoped_acquire::gil_scoped_acquire() -> detail::get_internals() ->
      ... -> pybind11::detail::simple_collector() -> uh oh..
      
      The solution is simple: we call detail::get_internals() once before
      running any binding code to make sure that the internal data structures
      are ready.
      bf2b0314
    • Wenzel Jakob's avatar
      bindings for import_error exception · 4c206e8c
      Wenzel Jakob authored
      4c206e8c
  8. Dec 31, 2019
  9. Dec 30, 2019
    • Wenzel Jakob's avatar
      Use C++17 fold expressions when casting tuples and argument lists (#2043) · f9f3bd71
      Wenzel Jakob authored
      This commit introduces the use of C++17-style fold expressions when
      casting tuples & the argument lists of functions.
      
      This change can improve performance of the resulting bindings: because
      fold expressions have short-circuiting semantics, pybind11 e.g. won't
      try to cast the second argument of a function if the first one failed.
      This is particularly effective when working with functions that have
      many overloads with long argument lists.
      f9f3bd71
  10. Dec 19, 2019
  11. Dec 13, 2019
  12. Dec 12, 2019
  13. Dec 11, 2019
  14. Nov 28, 2019
  15. Nov 25, 2019
  16. Nov 24, 2019
  17. Nov 16, 2019
  18. Nov 14, 2019
  19. Oct 31, 2019
  20. Oct 23, 2019
  21. Oct 22, 2019
  22. Oct 18, 2019
  23. Oct 17, 2019
    • nicolov's avatar
      Fix build with -Wmissing-prototypes (#1954) · de5a29c0
      nicolov authored
      When building with `-Werror,-Wmissing-prototypes`, `clang` complains about missing prototypes for functions defined through macro expansions. This PR adds the missing prototypes.
      
      ```
      error: no previous prototype for function 'pybind11_init_impl_embedded' [
      -Werror,-Wmissing-prototypes]                                           
      PYBIND11_EMBEDDED_MODULE(embedded, mod) {                                             
      ^                                                                           
      external/pybind11/include/pybind11/embed.h:61:5: note: expanded from macro 'PYBIND11_EMBEDDED_MODULE'
          PYBIND11_EMBEDDED_MODULE_IMPL(name)                                       \
          ^                                                                         
      external/pybind11/include/pybind11/embed.h:26:23: note: expanded from macro 'PYBIND11_EMBEDDED_MODULE_IMPL'
            extern "C" void pybind11_init_impl_##name() {      \                  
                            ^                                             
      <scratch space>:380:1: note: expanded from here                     
      pybind11_init_impl_embedded                                                                                                                      
      ^                                                                                                                                                
      1 error generated.
      ```
      de5a29c0
  24. Oct 15, 2019