limitations.rst 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. Limitations
  2. ###########
  3. Design choices
  4. ^^^^^^^^^^^^^^
  5. pybind11 strives to be a general solution to binding generation, but it also has
  6. certain limitations:
  7. - pybind11 casts away ``const``-ness in function arguments and return values.
  8. This is in line with the Python language, which has no concept of ``const``
  9. values. This means that some additional care is needed to avoid bugs that
  10. would be caught by the type checker in a traditional C++ program.
  11. - The NumPy interface ``pybind11::array`` greatly simplifies accessing
  12. numerical data from C++ (and vice versa), but it's not a full-blown array
  13. class like ``Eigen::Array`` or ``boost.multi_array``. ``Eigen`` objects are
  14. directly supported, however, with ``pybind11/eigen.h``.
  15. Large but useful features could be implemented in pybind11 but would lead to a
  16. significant increase in complexity. Pybind11 strives to be simple and compact.
  17. Users who require large new features are encouraged to write an extension to
  18. pybind11; see `pybind11_json <https://github.com/pybind/pybind11_json>`_ for an
  19. example.
  20. Known bugs
  21. ^^^^^^^^^^
  22. These are issues that hopefully will one day be fixed, but currently are
  23. unsolved. If you know how to help with one of these issues, contributions
  24. are welcome!
  25. - Intel 20.2 is currently having an issue with the test suite.
  26. `#2573 <https://github.com/pybind/pybind11/pull/2573>`_
  27. - Debug mode Python does not support 1-5 tests in the test suite currently.
  28. `#2422 <https://github.com/pybind/pybind11/pull/2422>`_
  29. - PyPy3 7.3.1 and 7.3.2 have issues with several tests on 32-bit Windows.
  30. Known limitations
  31. ^^^^^^^^^^^^^^^^^
  32. These are issues that are probably solvable, but have not been fixed yet. A
  33. clean, well written patch would likely be accepted to solve them.
  34. - Type casters are not kept alive recursively.
  35. `#2527 <https://github.com/pybind/pybind11/issues/2527>`_
  36. One consequence is that containers of ``char *`` are currently not supported.
  37. `#2245 <https://github.com/pybind/pybind11/issues/2245>`_
  38. - The ``cpptest`` does not run on Windows with Python 3.8 or newer, due to DLL
  39. loader changes. User code that is correctly installed should not be affected.
  40. `#2560 <https://github.com/pybind/pybind11/issue/2560>`_
  41. Python 3.9.0 warning
  42. ^^^^^^^^^^^^^^^^^^^^
  43. Combining older versions of pybind11 (< 2.6.0) with Python on 3.9.0 will
  44. trigger undefined behavior that typically manifests as crashes during
  45. interpreter shutdown (but could also destroy your data. **You have been
  46. warned**).
  47. This issue has been
  48. `fixed in Python <https://github.com/python/cpython/pull/22670>`_. As a
  49. mitigation until 3.9.1 is released and commonly used, pybind11 (2.6.0 or newer)
  50. includes a temporary workaround specifically when Python 3.9.0 is detected at
  51. runtime, leaking about 50 bytes of memory when a callback function is garbage
  52. collected. For reference; the pybind11 test suite has about 2,000 such
  53. callbacks, but only 49 are garbage collected before the end-of-process. Wheels
  54. built with Python 3.9.0 will correctly avoid the leak when run in Python 3.9.1.