You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2327 lines
97 KiB

  1. .. _changelog:
  2. Changelog
  3. #########
  4. Starting with version 1.8.0, pybind11 releases use a `semantic versioning
  5. <http://semver.org>`_ policy.
  6. Changes will be added here periodically from the "Suggested changelog entry"
  7. block in pull request descriptions.
  8. IN DEVELOPMENT
  9. --------------
  10. Removed support for Python 2.7, Python 3.5, and MSVC 2015. Support for MSVC
  11. 2017 is limited due to availability of CI runners; we highly recommend MSVC
  12. 2019 or 2022 be used.
  13. New features:
  14. * ``type_caster<std::monostate>`` was added. ``std::monostate`` is a tag type
  15. that allows ``std::variant`` to act as an optional, or allows default
  16. construction of a ``std::variant`` holding a non-default constructible type.
  17. `#3818 <https://github.com/pybind/pybind11/pull/3818>`_
  18. * Support bytearray casting to string.
  19. `#3707 <https://github.com/pybind/pybind11/pull/3707>`_
  20. Changes:
  21. * Python 2 support was removed completely.
  22. `#3688 <https://github.com/pybind/pybind11/pull/3688>`_
  23. * The minimum version for MSVC is now 2017.
  24. `#3722 <https://github.com/pybind/pybind11/pull/3722>`_
  25. * Improve exception handling in python ``str`` bindings.
  26. `#3826 <https://github.com/pybind/pybind11/pull/3826>`_
  27. * The bindings for capsules now have more consistent exception handling.
  28. `#3825 <https://github.com/pybind/pybind11/pull/3825>`_
  29. * Fix exception handling when ``pybind11::weakref()`` fails.
  30. `#3739 <https://github.com/pybind/pybind11/pull/3739>`_
  31. Bug fixes:
  32. * ``PYBIND11_OBJECT_CVT`` and ``PYBIND11_OBJECT_CVT_DEFAULT`` macro can be used
  33. to define classes in namespaces other than pybind11.
  34. `#3797 <https://github.com/pybind/pybind11/pull/3797>`_
  35. Build system improvements:
  36. * Add MSVC builds in debug mode to CI.
  37. `#3784 <https://github.com/pybind/pybind11/pull/3784>`_
  38. * MSVC 2022 C++20 coverage was added to GitHub Actions, including Eigen.
  39. `#3732 <https://github.com/pybind/pybind11/pull/3732>`_,
  40. `#3741 <https://github.com/pybind/pybind11/pull/3741>`_
  41. * Avoid ``setup.py <command>`` usage in internal tests.
  42. `#3734 <https://github.com/pybind/pybind11/pull/3734>`_
  43. Backend and tidying up:
  44. * Remove idioms in code comments. Use inclusive language.
  45. `#3809 <https://github.com/pybind/pybind11/pull/3809>`_
  46. Version 2.9.2 (Mar 29, 2022)
  47. ----------------------------
  48. Changes:
  49. * Enum now has an ``__index__`` method on Python <3.8 too.
  50. `#3700 <https://github.com/pybind/pybind11/pull/3700>`_
  51. * Local internals are now cleared after finalizing the interpreter.
  52. `#3744 <https://github.com/pybind/pybind11/pull/3744>`_
  53. Bug fixes:
  54. * Better support for Python 3.11 alphas.
  55. `#3694 <https://github.com/pybind/pybind11/pull/3694>`_
  56. * ``PYBIND11_TYPE_CASTER`` now uses fully qualified symbols, so it can be used
  57. outside of ``pybind11::detail``.
  58. `#3758 <https://github.com/pybind/pybind11/pull/3758>`_
  59. * Some fixes for PyPy 3.9.
  60. `#3768 <https://github.com/pybind/pybind11/pull/3768>`_
  61. * Fixed a potential memleak in PyPy in ``get_type_override``.
  62. `#3774 <https://github.com/pybind/pybind11/pull/3774>`_
  63. * Fix usage of ``VISIBILITY_INLINES_HIDDEN``.
  64. `#3721 <https://github.com/pybind/pybind11/pull/3721>`_
  65. Build system improvements:
  66. * Uses ``sysconfig`` module to determine installation locations on Python >=
  67. 3.10, instead of ``distutils`` which has been deprecated.
  68. `#3764 <https://github.com/pybind/pybind11/pull/3764>`_
  69. * Support Catch 2.13.5+ (supporting GLIBC 2.34+).
  70. `#3679 <https://github.com/pybind/pybind11/pull/3679>`_
  71. * Fix test failures with numpy 1.22 by ignoring whitespace when comparing
  72. ``str()`` of dtypes.
  73. `#3682 <https://github.com/pybind/pybind11/pull/3682>`_
  74. Backend and tidying up:
  75. * clang-tidy: added ``readability-qualified-auto``,
  76. ``readability-braces-around-statements``,
  77. ``cppcoreguidelines-prefer-member-initializer``,
  78. ``clang-analyzer-optin.performance.Padding``,
  79. ``cppcoreguidelines-pro-type-static-cast-downcast``, and
  80. ``readability-inconsistent-declaration-parameter-name``.
  81. `#3702 <https://github.com/pybind/pybind11/pull/3702>`_,
  82. `#3699 <https://github.com/pybind/pybind11/pull/3699>`_,
  83. `#3716 <https://github.com/pybind/pybind11/pull/3716>`_,
  84. `#3709 <https://github.com/pybind/pybind11/pull/3709>`_
  85. * clang-format was added to the pre-commit actions, and the entire code base
  86. automatically reformatted (after several iterations preparing for this leap).
  87. `#3713 <https://github.com/pybind/pybind11/pull/3713>`_
  88. Version 2.9.1 (Feb 2, 2022)
  89. ---------------------------
  90. Changes:
  91. * If possible, attach Python exception with ``py::raise_from`` to ``TypeError``
  92. when casting from C++ to Python. This will give additional info if Python
  93. exceptions occur in the caster. Adds a test case of trying to convert a set
  94. from C++ to Python when the hash function is not defined in Python.
  95. `#3605 <https://github.com/pybind/pybind11/pull/3605>`_
  96. * Add a mapping of C++11 nested exceptions to their Python exception
  97. equivalent using ``py::raise_from``. This attaches the nested exceptions in
  98. Python using the ``__cause__`` field.
  99. `#3608 <https://github.com/pybind/pybind11/pull/3608>`_
  100. * Propagate Python exception traceback using ``raise_from`` if a pybind11
  101. function runs out of overloads.
  102. `#3671 <https://github.com/pybind/pybind11/pull/3671>`_
  103. * ``py::multiple_inheritance`` is now only needed when C++ bases are hidden
  104. from pybind11.
  105. `#3650 <https://github.com/pybind/pybind11/pull/3650>`_ and
  106. `#3659 <https://github.com/pybind/pybind11/pull/3659>`_
  107. Bug fixes:
  108. * Remove a boolean cast in ``numpy.h`` that causes MSVC C4800 warnings when
  109. compiling against Python 3.10 or newer.
  110. `#3669 <https://github.com/pybind/pybind11/pull/3669>`_
  111. * Render ``py::bool_`` and ``py::float_`` as ``bool`` and ``float``
  112. respectively.
  113. `#3622 <https://github.com/pybind/pybind11/pull/3622>`_
  114. Build system improvements:
  115. * Fix CMake extension suffix computation on Python 3.10+.
  116. `#3663 <https://github.com/pybind/pybind11/pull/3663>`_
  117. * Allow ``CMAKE_ARGS`` to override CMake args in pybind11's own ``setup.py``.
  118. `#3577 <https://github.com/pybind/pybind11/pull/3577>`_
  119. * Remove a few deprecated c-headers.
  120. `#3610 <https://github.com/pybind/pybind11/pull/3610>`_
  121. * More uniform handling of test targets.
  122. `#3590 <https://github.com/pybind/pybind11/pull/3590>`_
  123. * Add clang-tidy readability check to catch potentially swapped function args.
  124. `#3611 <https://github.com/pybind/pybind11/pull/3611>`_
  125. Version 2.9.0 (Dec 28, 2021)
  126. ----------------------------
  127. This is the last version to support Python 2.7 and 3.5.
  128. New Features:
  129. * Allow ``py::args`` to be followed by other arguments; the remaining arguments
  130. are implicitly keyword-only, as if a ``py::kw_only{}`` annotation had been
  131. used.
  132. `#3402 <https://github.com/pybind/pybind11/pull/3402>`_
  133. Changes:
  134. * Make str/bytes/memoryview more interoperable with ``std::string_view``.
  135. `#3521 <https://github.com/pybind/pybind11/pull/3521>`_
  136. * Replace ``_`` with ``const_name`` in internals, avoid defining ``pybind::_``
  137. if ``_`` defined as macro (common gettext usage)
  138. `#3423 <https://github.com/pybind/pybind11/pull/3423>`_
  139. Bug fixes:
  140. * Fix a rare warning about extra copy in an Eigen constructor.
  141. `#3486 <https://github.com/pybind/pybind11/pull/3486>`_
  142. * Fix caching of the C++ overrides.
  143. `#3465 <https://github.com/pybind/pybind11/pull/3465>`_
  144. * Add missing ``std::forward`` calls to some ``cpp_function`` overloads.
  145. `#3443 <https://github.com/pybind/pybind11/pull/3443>`_
  146. * Support PyPy 7.3.7 and the PyPy3.8 beta. Test python-3.11 on PRs with the
  147. ``python dev`` label.
  148. `#3419 <https://github.com/pybind/pybind11/pull/3419>`_
  149. * Replace usage of deprecated ``Eigen::MappedSparseMatrix`` with
  150. ``Eigen::Map<Eigen::SparseMatrix<...>>`` for Eigen 3.3+.
  151. `#3499 <https://github.com/pybind/pybind11/pull/3499>`_
  152. * Tweaks to support Microsoft Visual Studio 2022.
  153. `#3497 <https://github.com/pybind/pybind11/pull/3497>`_
  154. Build system improvements:
  155. * Nicer CMake printout and IDE organisation for pybind11's own tests.
  156. `#3479 <https://github.com/pybind/pybind11/pull/3479>`_
  157. * CMake: report version type as part of the version string to avoid a spurious
  158. space in the package status message.
  159. `#3472 <https://github.com/pybind/pybind11/pull/3472>`_
  160. * Flags starting with ``-g`` in ``$CFLAGS`` and ``$CPPFLAGS`` are no longer
  161. overridden by ``.Pybind11Extension``.
  162. `#3436 <https://github.com/pybind/pybind11/pull/3436>`_
  163. * Ensure ThreadPool is closed in ``setup_helpers``.
  164. `#3548 <https://github.com/pybind/pybind11/pull/3548>`_
  165. * Avoid LTS on ``mips64`` and ``ppc64le`` (reported broken).
  166. `#3557 <https://github.com/pybind/pybind11/pull/3557>`_
  167. v2.8.1 (Oct 27, 2021)
  168. ---------------------
  169. Changes and additions:
  170. * The simple namespace creation shortcut added in 2.8.0 was deprecated due to
  171. usage of CPython internal API, and will be removed soon. Use
  172. ``py::module_::import("types").attr("SimpleNamespace")``.
  173. `#3374 <https://github.com/pybinyyd/pybind11/pull/3374>`_
  174. * Add C++ Exception type to throw and catch ``AttributeError``. Useful for
  175. defining custom ``__setattr__`` and ``__getattr__`` methods.
  176. `#3387 <https://github.com/pybind/pybind11/pull/3387>`_
  177. Fixes:
  178. * Fixed the potential for dangling references when using properties with
  179. ``std::optional`` types.
  180. `#3376 <https://github.com/pybind/pybind11/pull/3376>`_
  181. * Modernize usage of ``PyCodeObject`` on Python 3.9+ (moving toward support for
  182. Python 3.11a1)
  183. `#3368 <https://github.com/pybind/pybind11/pull/3368>`_
  184. * A long-standing bug in ``eigen.h`` was fixed (originally PR #3343). The bug
  185. was unmasked by newly added ``static_assert``'s in the Eigen 3.4.0 release.
  186. `#3352 <https://github.com/pybind/pybind11/pull/3352>`_
  187. * Support multiple raw inclusion of CMake helper files (Conan.io does this for
  188. multi-config generators).
  189. `#3420 <https://github.com/pybind/pybind11/pull/3420>`_
  190. * Fix harmless warning on upcoming CMake 3.22.
  191. `#3368 <https://github.com/pybind/pybind11/pull/3368>`_
  192. * Fix 2.8.0 regression with MSVC 2017 + C++17 mode + Python 3.
  193. `#3407 <https://github.com/pybind/pybind11/pull/3407>`_
  194. * Fix 2.8.0 regression that caused undefined behavior (typically
  195. segfaults) in ``make_key_iterator``/``make_value_iterator`` if dereferencing
  196. the iterator returned a temporary value instead of a reference.
  197. `#3348 <https://github.com/pybind/pybind11/pull/3348>`_
  198. v2.8.0 (Oct 4, 2021)
  199. --------------------
  200. New features:
  201. * Added ``py::raise_from`` to enable chaining exceptions.
  202. `#3215 <https://github.com/pybind/pybind11/pull/3215>`_
  203. * Allow exception translators to be optionally registered local to a module
  204. instead of applying globally across all pybind11 modules. Use
  205. ``register_local_exception_translator(ExceptionTranslator&& translator)``
  206. instead of ``register_exception_translator(ExceptionTranslator&&
  207. translator)`` to keep your exception remapping code local to the module.
  208. `#2650 <https://github.com/pybinyyd/pybind11/pull/2650>`_
  209. * Add ``make_simple_namespace`` function for instantiating Python
  210. ``SimpleNamespace`` objects. **Deprecated in 2.8.1.**
  211. `#2840 <https://github.com/pybind/pybind11/pull/2840>`_
  212. * ``pybind11::scoped_interpreter`` and ``initialize_interpreter`` have new
  213. arguments to allow ``sys.argv`` initialization.
  214. `#2341 <https://github.com/pybind/pybind11/pull/2341>`_
  215. * Allow Python builtins to be used as callbacks in CPython.
  216. `#1413 <https://github.com/pybind/pybind11/pull/1413>`_
  217. * Added ``view`` to view arrays with a different datatype.
  218. `#987 <https://github.com/pybind/pybind11/pull/987>`_
  219. * Implemented ``reshape`` on arrays.
  220. `#984 <https://github.com/pybind/pybind11/pull/984>`_
  221. * Enable defining custom ``__new__`` methods on classes by fixing bug
  222. preventing overriding methods if they have non-pybind11 siblings.
  223. `#3265 <https://github.com/pybind/pybind11/pull/3265>`_
  224. * Add ``make_value_iterator()``, and fix ``make_key_iterator()`` to return
  225. references instead of copies.
  226. `#3293 <https://github.com/pybind/pybind11/pull/3293>`_
  227. * Improve the classes generated by ``bind_map``: `#3310 <https://github.com/pybind/pybind11/pull/3310>`_
  228. * Change ``.items`` from an iterator to a dictionary view.
  229. * Add ``.keys`` and ``.values`` (both dictionary views).
  230. * Allow ``__contains__`` to take any object.
  231. * ``pybind11::custom_type_setup`` was added, for customizing the
  232. ``PyHeapTypeObject`` corresponding to a class, which may be useful for
  233. enabling garbage collection support, among other things.
  234. `#3287 <https://github.com/pybind/pybind11/pull/3287>`_
  235. Changes:
  236. * Set ``__file__`` constant when running ``eval_file`` in an embedded interpreter.
  237. `#3233 <https://github.com/pybind/pybind11/pull/3233>`_
  238. * Python objects and (C++17) ``std::optional`` now accepted in ``py::slice``
  239. constructor.
  240. `#1101 <https://github.com/pybind/pybind11/pull/1101>`_
  241. * The pybind11 proxy types ``str``, ``bytes``, ``bytearray``, ``tuple``,
  242. ``list`` now consistently support passing ``ssize_t`` values for sizes and
  243. indexes. Previously, only ``size_t`` was accepted in several interfaces.
  244. `#3219 <https://github.com/pybind/pybind11/pull/3219>`_
  245. * Avoid evaluating ``PYBIND11_TLS_REPLACE_VALUE`` arguments more than once.
  246. `#3290 <https://github.com/pybind/pybind11/pull/3290>`_
  247. Fixes:
  248. * Bug fix: enum value's ``__int__`` returning non-int when underlying type is
  249. bool or of char type.
  250. `#1334 <https://github.com/pybind/pybind11/pull/1334>`_
  251. * Fixes bug in setting error state in Capsule's pointer methods.
  252. `#3261 <https://github.com/pybind/pybind11/pull/3261>`_
  253. * A long-standing memory leak in ``py::cpp_function::initialize`` was fixed.
  254. `#3229 <https://github.com/pybind/pybind11/pull/3229>`_
  255. * Fixes thread safety for some ``pybind11::type_caster`` which require lifetime
  256. extension, such as for ``std::string_view``.
  257. `#3237 <https://github.com/pybind/pybind11/pull/3237>`_
  258. * Restore compatibility with gcc 4.8.4 as distributed by ubuntu-trusty, linuxmint-17.
  259. `#3270 <https://github.com/pybind/pybind11/pull/3270>`_
  260. Build system improvements:
  261. * Fix regression in CMake Python package config: improper use of absolute path.
  262. `#3144 <https://github.com/pybind/pybind11/pull/3144>`_
  263. * Cached Python version information could become stale when CMake was re-run
  264. with a different Python version. The build system now detects this and
  265. updates this information.
  266. `#3299 <https://github.com/pybind/pybind11/pull/3299>`_
  267. * Specified UTF8-encoding in setup.py calls of open().
  268. `#3137 <https://github.com/pybind/pybind11/pull/3137>`_
  269. * Fix a harmless warning from CMake 3.21 with the classic Python discovery.
  270. `#3220 <https://github.com/pybind/pybind11/pull/3220>`_
  271. * Eigen repo and version can now be specified as cmake options.
  272. `#3324 <https://github.com/pybind/pybind11/pull/3324>`_
  273. Backend and tidying up:
  274. * Reduced thread-local storage required for keeping alive temporary data for
  275. type conversion to one key per ABI version, rather than one key per extension
  276. module. This makes the total thread-local storage required by pybind11 2
  277. keys per ABI version.
  278. `#3275 <https://github.com/pybind/pybind11/pull/3275>`_
  279. * Optimize NumPy array construction with additional moves.
  280. `#3183 <https://github.com/pybind/pybind11/pull/3183>`_
  281. * Conversion to ``std::string`` and ``std::string_view`` now avoids making an
  282. extra copy of the data on Python >= 3.3.
  283. `#3257 <https://github.com/pybind/pybind11/pull/3257>`_
  284. * Remove const modifier from certain C++ methods on Python collections
  285. (``list``, ``set``, ``dict``) such as (``clear()``, ``append()``,
  286. ``insert()``, etc...) and annotated them with ``py-non-const``.
  287. * Enable readability ``clang-tidy-const-return`` and remove useless consts.
  288. `#3254 <https://github.com/pybind/pybind11/pull/3254>`_
  289. `#3194 <https://github.com/pybind/pybind11/pull/3194>`_
  290. * The clang-tidy ``google-explicit-constructor`` option was enabled.
  291. `#3250 <https://github.com/pybind/pybind11/pull/3250>`_
  292. * Mark a pytype move constructor as noexcept (perf).
  293. `#3236 <https://github.com/pybind/pybind11/pull/3236>`_
  294. * Enable clang-tidy check to guard against inheritance slicing.
  295. `#3210 <https://github.com/pybind/pybind11/pull/3210>`_
  296. * Legacy warning suppression pragma were removed from eigen.h. On Unix
  297. platforms, please use -isystem for Eigen include directories, to suppress
  298. compiler warnings originating from Eigen headers. Note that CMake does this
  299. by default. No adjustments are needed for Windows.
  300. `#3198 <https://github.com/pybind/pybind11/pull/3198>`_
  301. * Format pybind11 with isort consistent ordering of imports
  302. `#3195 <https://github.com/pybind/pybind11/pull/3195>`_
  303. * The warnings-suppression "pragma clamp" at the top/bottom of pybind11 was
  304. removed, clearing the path to refactoring and IWYU cleanup.
  305. `#3186 <https://github.com/pybind/pybind11/pull/3186>`_
  306. * Enable most bugprone checks in clang-tidy and fix the found potential bugs
  307. and poor coding styles.
  308. `#3166 <https://github.com/pybind/pybind11/pull/3166>`_
  309. * Add ``clang-tidy-readability`` rules to make boolean casts explicit improving
  310. code readability. Also enabled other misc and readability clang-tidy checks.
  311. `#3148 <https://github.com/pybind/pybind11/pull/3148>`_
  312. * Move object in ``.pop()`` for list.
  313. `#3116 <https://github.com/pybind/pybind11/pull/3116>`_
  314. v2.7.1 (Aug 3, 2021)
  315. ---------------------
  316. Minor missing functionality added:
  317. * Allow Python builtins to be used as callbacks in CPython.
  318. `#1413 <https://github.com/pybind/pybind11/pull/1413>`_
  319. Bug fixes:
  320. * Fix regression in CMake Python package config: improper use of absolute path.
  321. `#3144 <https://github.com/pybind/pybind11/pull/3144>`_
  322. * Fix Mingw64 and add to the CI testing matrix.
  323. `#3132 <https://github.com/pybind/pybind11/pull/3132>`_
  324. * Specified UTF8-encoding in setup.py calls of open().
  325. `#3137 <https://github.com/pybind/pybind11/pull/3137>`_
  326. * Add clang-tidy-readability rules to make boolean casts explicit improving
  327. code readability. Also enabled other misc and readability clang-tidy checks.
  328. `#3148 <https://github.com/pybind/pybind11/pull/3148>`_
  329. * Move object in ``.pop()`` for list.
  330. `#3116 <https://github.com/pybind/pybind11/pull/3116>`_
  331. Backend and tidying up:
  332. * Removed and fixed warning suppressions.
  333. `#3127 <https://github.com/pybind/pybind11/pull/3127>`_
  334. `#3129 <https://github.com/pybind/pybind11/pull/3129>`_
  335. `#3135 <https://github.com/pybind/pybind11/pull/3135>`_
  336. `#3141 <https://github.com/pybind/pybind11/pull/3141>`_
  337. `#3142 <https://github.com/pybind/pybind11/pull/3142>`_
  338. `#3150 <https://github.com/pybind/pybind11/pull/3150>`_
  339. `#3152 <https://github.com/pybind/pybind11/pull/3152>`_
  340. `#3160 <https://github.com/pybind/pybind11/pull/3160>`_
  341. `#3161 <https://github.com/pybind/pybind11/pull/3161>`_
  342. v2.7.0 (Jul 16, 2021)
  343. ---------------------
  344. New features:
  345. * Enable ``py::implicitly_convertible<py::none, ...>`` for
  346. ``py::class_``-wrapped types.
  347. `#3059 <https://github.com/pybind/pybind11/pull/3059>`_
  348. * Allow function pointer extraction from overloaded functions.
  349. `#2944 <https://github.com/pybind/pybind11/pull/2944>`_
  350. * NumPy: added ``.char_()`` to type which gives the NumPy public ``char``
  351. result, which also distinguishes types by bit length (unlike ``.kind()``).
  352. `#2864 <https://github.com/pybind/pybind11/pull/2864>`_
  353. * Add ``pybind11::bytearray`` to manipulate ``bytearray`` similar to ``bytes``.
  354. `#2799 <https://github.com/pybind/pybind11/pull/2799>`_
  355. * ``pybind11/stl/filesystem.h`` registers a type caster that, on C++17/Python
  356. 3.6+, converts ``std::filesystem::path`` to ``pathlib.Path`` and any
  357. ``os.PathLike`` to ``std::filesystem::path``.
  358. `#2730 <https://github.com/pybind/pybind11/pull/2730>`_
  359. * A ``PYBIND11_VERSION_HEX`` define was added, similar to ``PY_VERSION_HEX``.
  360. `#3120 <https://github.com/pybind/pybind11/pull/3120>`_
  361. Changes:
  362. * ``py::str`` changed to exclusively hold ``PyUnicodeObject``. Previously
  363. ``py::str`` could also hold ``bytes``, which is probably surprising, was
  364. never documented, and can mask bugs (e.g. accidental use of ``py::str``
  365. instead of ``py::bytes``).
  366. `#2409 <https://github.com/pybind/pybind11/pull/2409>`_
  367. * Add a safety guard to ensure that the Python GIL is held when C++ calls back
  368. into Python via ``object_api<>::operator()`` (e.g. ``py::function``
  369. ``__call__``). (This feature is available for Python 3.6+ only.)
  370. `#2919 <https://github.com/pybind/pybind11/pull/2919>`_
  371. * Catch a missing ``self`` argument in calls to ``__init__()``.
  372. `#2914 <https://github.com/pybind/pybind11/pull/2914>`_
  373. * Use ``std::string_view`` if available to avoid a copy when passing an object
  374. to a ``std::ostream``.
  375. `#3042 <https://github.com/pybind/pybind11/pull/3042>`_
  376. * An important warning about thread safety was added to the ``iostream.h``
  377. documentation; attempts to make ``py::scoped_ostream_redirect`` thread safe
  378. have been removed, as it was only partially effective.
  379. `#2995 <https://github.com/pybind/pybind11/pull/2995>`_
  380. Fixes:
  381. * Performance: avoid unnecessary strlen calls.
  382. `#3058 <https://github.com/pybind/pybind11/pull/3058>`_
  383. * Fix auto-generated documentation string when using ``const T`` in
  384. ``pyarray_t``.
  385. `#3020 <https://github.com/pybind/pybind11/pull/3020>`_
  386. * Unify error messages thrown by ``simple_collector``/``unpacking_collector``.
  387. `#3013 <https://github.com/pybind/pybind11/pull/3013>`_
  388. * ``pybind11::builtin_exception`` is now explicitly exported, which means the
  389. types included/defined in different modules are identical, and exceptions
  390. raised in different modules can be caught correctly. The documentation was
  391. updated to explain that custom exceptions that are used across module
  392. boundaries need to be explicitly exported as well.
  393. `#2999 <https://github.com/pybind/pybind11/pull/2999>`_
  394. * Fixed exception when printing UTF-8 to a ``scoped_ostream_redirect``.
  395. `#2982 <https://github.com/pybind/pybind11/pull/2982>`_
  396. * Pickle support enhancement: ``setstate`` implementation will attempt to
  397. ``setattr`` ``__dict__`` only if the unpickled ``dict`` object is not empty,
  398. to not force use of ``py::dynamic_attr()`` unnecessarily.
  399. `#2972 <https://github.com/pybind/pybind11/pull/2972>`_
  400. * Allow negative timedelta values to roundtrip.
  401. `#2870 <https://github.com/pybind/pybind11/pull/2870>`_
  402. * Fix unchecked errors could potentially swallow signals/other exceptions.
  403. `#2863 <https://github.com/pybind/pybind11/pull/2863>`_
  404. * Add null pointer check with ``std::localtime``.
  405. `#2846 <https://github.com/pybind/pybind11/pull/2846>`_
  406. * Fix the ``weakref`` constructor from ``py::object`` to create a new
  407. ``weakref`` on conversion.
  408. `#2832 <https://github.com/pybind/pybind11/pull/2832>`_
  409. * Avoid relying on exceptions in C++17 when getting a ``shared_ptr`` holder
  410. from a ``shared_from_this`` class.
  411. `#2819 <https://github.com/pybind/pybind11/pull/2819>`_
  412. * Allow the codec's exception to be raised instead of :code:`RuntimeError` when
  413. casting from :code:`py::str` to :code:`std::string`.
  414. `#2903 <https://github.com/pybind/pybind11/pull/2903>`_
  415. Build system improvements:
  416. * In ``setup_helpers.py``, test for platforms that have some multiprocessing
  417. features but lack semaphores, which ``ParallelCompile`` requires.
  418. `#3043 <https://github.com/pybind/pybind11/pull/3043>`_
  419. * Fix ``pybind11_INCLUDE_DIR`` in case ``CMAKE_INSTALL_INCLUDEDIR`` is
  420. absolute.
  421. `#3005 <https://github.com/pybind/pybind11/pull/3005>`_
  422. * Fix bug not respecting ``WITH_SOABI`` or ``WITHOUT_SOABI`` to CMake.
  423. `#2938 <https://github.com/pybind/pybind11/pull/2938>`_
  424. * Fix the default ``Pybind11Extension`` compilation flags with a Mingw64 python.
  425. `#2921 <https://github.com/pybind/pybind11/pull/2921>`_
  426. * Clang on Windows: do not pass ``/MP`` (ignored flag).
  427. `#2824 <https://github.com/pybind/pybind11/pull/2824>`_
  428. * ``pybind11.setup_helpers.intree_extensions`` can be used to generate
  429. ``Pybind11Extension`` instances from cpp files placed in the Python package
  430. source tree.
  431. `#2831 <https://github.com/pybind/pybind11/pull/2831>`_
  432. Backend and tidying up:
  433. * Enable clang-tidy performance, readability, and modernization checks
  434. throughout the codebase to enforce best coding practices.
  435. `#3046 <https://github.com/pybind/pybind11/pull/3046>`_,
  436. `#3049 <https://github.com/pybind/pybind11/pull/3049>`_,
  437. `#3051 <https://github.com/pybind/pybind11/pull/3051>`_,
  438. `#3052 <https://github.com/pybind/pybind11/pull/3052>`_,
  439. `#3080 <https://github.com/pybind/pybind11/pull/3080>`_, and
  440. `#3094 <https://github.com/pybind/pybind11/pull/3094>`_
  441. * Checks for common misspellings were added to the pre-commit hooks.
  442. `#3076 <https://github.com/pybind/pybind11/pull/3076>`_
  443. * Changed ``Werror`` to stricter ``Werror-all`` for Intel compiler and fixed
  444. minor issues.
  445. `#2948 <https://github.com/pybind/pybind11/pull/2948>`_
  446. * Fixed compilation with GCC < 5 when the user defines ``_GLIBCXX_USE_CXX11_ABI``.
  447. `#2956 <https://github.com/pybind/pybind11/pull/2956>`_
  448. * Added nox support for easier local testing and linting of contributions.
  449. `#3101 <https://github.com/pybind/pybind11/pull/3101>`_ and
  450. `#3121 <https://github.com/pybind/pybind11/pull/3121>`_
  451. * Avoid RTD style issue with docutils 0.17+.
  452. `#3119 <https://github.com/pybind/pybind11/pull/3119>`_
  453. * Support pipx run, such as ``pipx run pybind11 --include`` for a quick compile.
  454. `#3117 <https://github.com/pybind/pybind11/pull/3117>`_
  455. v2.6.2 (Jan 26, 2021)
  456. ---------------------
  457. Minor missing functionality added:
  458. * enum: add missing Enum.value property.
  459. `#2739 <https://github.com/pybind/pybind11/pull/2739>`_
  460. * Allow thread termination to be avoided during shutdown for CPython 3.7+ via
  461. ``.disarm`` for ``gil_scoped_acquire``/``gil_scoped_release``.
  462. `#2657 <https://github.com/pybind/pybind11/pull/2657>`_
  463. Fixed or improved behavior in a few special cases:
  464. * Fix bug where the constructor of ``object`` subclasses would not throw on
  465. being passed a Python object of the wrong type.
  466. `#2701 <https://github.com/pybind/pybind11/pull/2701>`_
  467. * The ``type_caster`` for integers does not convert Python objects with
  468. ``__int__`` anymore with ``noconvert`` or during the first round of trying
  469. overloads.
  470. `#2698 <https://github.com/pybind/pybind11/pull/2698>`_
  471. * When casting to a C++ integer, ``__index__`` is always called and not
  472. considered as conversion, consistent with Python 3.8+.
  473. `#2801 <https://github.com/pybind/pybind11/pull/2801>`_
  474. Build improvements:
  475. * Setup helpers: ``extra_compile_args`` and ``extra_link_args`` automatically set by
  476. Pybind11Extension are now prepended, which allows them to be overridden
  477. by user-set ``extra_compile_args`` and ``extra_link_args``.
  478. `#2808 <https://github.com/pybind/pybind11/pull/2808>`_
  479. * Setup helpers: Don't trigger unused parameter warning.
  480. `#2735 <https://github.com/pybind/pybind11/pull/2735>`_
  481. * CMake: Support running with ``--warn-uninitialized`` active.
  482. `#2806 <https://github.com/pybind/pybind11/pull/2806>`_
  483. * CMake: Avoid error if included from two submodule directories.
  484. `#2804 <https://github.com/pybind/pybind11/pull/2804>`_
  485. * CMake: Fix ``STATIC`` / ``SHARED`` being ignored in FindPython mode.
  486. `#2796 <https://github.com/pybind/pybind11/pull/2796>`_
  487. * CMake: Respect the setting for ``CMAKE_CXX_VISIBILITY_PRESET`` if defined.
  488. `#2793 <https://github.com/pybind/pybind11/pull/2793>`_
  489. * CMake: Fix issue with FindPython2/FindPython3 not working with ``pybind11::embed``.
  490. `#2662 <https://github.com/pybind/pybind11/pull/2662>`_
  491. * CMake: mixing local and installed pybind11's would prioritize the installed
  492. one over the local one (regression in 2.6.0).
  493. `#2716 <https://github.com/pybind/pybind11/pull/2716>`_
  494. Bug fixes:
  495. * Fixed segfault in multithreaded environments when using
  496. ``scoped_ostream_redirect``.
  497. `#2675 <https://github.com/pybind/pybind11/pull/2675>`_
  498. * Leave docstring unset when all docstring-related options are disabled, rather
  499. than set an empty string.
  500. `#2745 <https://github.com/pybind/pybind11/pull/2745>`_
  501. * The module key in builtins that pybind11 uses to store its internals changed
  502. from std::string to a python str type (more natural on Python 2, no change on
  503. Python 3).
  504. `#2814 <https://github.com/pybind/pybind11/pull/2814>`_
  505. * Fixed assertion error related to unhandled (later overwritten) exception in
  506. CPython 3.8 and 3.9 debug builds.
  507. `#2685 <https://github.com/pybind/pybind11/pull/2685>`_
  508. * Fix ``py::gil_scoped_acquire`` assert with CPython 3.9 debug build.
  509. `#2683 <https://github.com/pybind/pybind11/pull/2683>`_
  510. * Fix issue with a test failing on pytest 6.2.
  511. `#2741 <https://github.com/pybind/pybind11/pull/2741>`_
  512. Warning fixes:
  513. * Fix warning modifying constructor parameter 'flag' that shadows a field of
  514. 'set_flag' ``[-Wshadow-field-in-constructor-modified]``.
  515. `#2780 <https://github.com/pybind/pybind11/pull/2780>`_
  516. * Suppressed some deprecation warnings about old-style
  517. ``__init__``/``__setstate__`` in the tests.
  518. `#2759 <https://github.com/pybind/pybind11/pull/2759>`_
  519. Valgrind work:
  520. * Fix invalid access when calling a pybind11 ``__init__`` on a non-pybind11
  521. class instance.
  522. `#2755 <https://github.com/pybind/pybind11/pull/2755>`_
  523. * Fixed various minor memory leaks in pybind11's test suite.
  524. `#2758 <https://github.com/pybind/pybind11/pull/2758>`_
  525. * Resolved memory leak in cpp_function initialization when exceptions occurred.
  526. `#2756 <https://github.com/pybind/pybind11/pull/2756>`_
  527. * Added a Valgrind build, checking for leaks and memory-related UB, to CI.
  528. `#2746 <https://github.com/pybind/pybind11/pull/2746>`_
  529. Compiler support:
  530. * Intel compiler was not activating C++14 support due to a broken define.
  531. `#2679 <https://github.com/pybind/pybind11/pull/2679>`_
  532. * Support ICC and NVIDIA HPC SDK in C++17 mode.
  533. `#2729 <https://github.com/pybind/pybind11/pull/2729>`_
  534. * Support Intel OneAPI compiler (ICC 20.2) and add to CI.
  535. `#2573 <https://github.com/pybind/pybind11/pull/2573>`_
  536. v2.6.1 (Nov 11, 2020)
  537. ---------------------
  538. * ``py::exec``, ``py::eval``, and ``py::eval_file`` now add the builtins module
  539. as ``"__builtins__"`` to their ``globals`` argument, better matching ``exec``
  540. and ``eval`` in pure Python.
  541. `#2616 <https://github.com/pybind/pybind11/pull/2616>`_
  542. * ``setup_helpers`` will no longer set a minimum macOS version higher than the
  543. current version.
  544. `#2622 <https://github.com/pybind/pybind11/pull/2622>`_
  545. * Allow deleting static properties.
  546. `#2629 <https://github.com/pybind/pybind11/pull/2629>`_
  547. * Seal a leak in ``def_buffer``, cleaning up the ``capture`` object after the
  548. ``class_`` object goes out of scope.
  549. `#2634 <https://github.com/pybind/pybind11/pull/2634>`_
  550. * ``pybind11_INCLUDE_DIRS`` was incorrect, potentially causing a regression if
  551. it was expected to include ``PYTHON_INCLUDE_DIRS`` (please use targets
  552. instead).
  553. `#2636 <https://github.com/pybind/pybind11/pull/2636>`_
  554. * Added parameter names to the ``py::enum_`` constructor and methods, avoiding
  555. ``arg0`` in the generated docstrings.
  556. `#2637 <https://github.com/pybind/pybind11/pull/2637>`_
  557. * Added ``needs_recompile`` optional function to the ``ParallelCompiler``
  558. helper, to allow a recompile to be skipped based on a user-defined function.
  559. `#2643 <https://github.com/pybind/pybind11/pull/2643>`_
  560. v2.6.0 (Oct 21, 2020)
  561. ---------------------
  562. See :ref:`upgrade-guide-2.6` for help upgrading to the new version.
  563. New features:
  564. * Keyword-only arguments supported in Python 2 or 3 with ``py::kw_only()``.
  565. `#2100 <https://github.com/pybind/pybind11/pull/2100>`_
  566. * Positional-only arguments supported in Python 2 or 3 with ``py::pos_only()``.
  567. `#2459 <https://github.com/pybind/pybind11/pull/2459>`_
  568. * ``py::is_final()`` class modifier to block subclassing (CPython only).
  569. `#2151 <https://github.com/pybind/pybind11/pull/2151>`_
  570. * Added ``py::prepend()``, allowing a function to be placed at the beginning of
  571. the overload chain.
  572. `#1131 <https://github.com/pybind/pybind11/pull/1131>`_
  573. * Access to the type object now provided with ``py::type::of<T>()`` and
  574. ``py::type::of(h)``.
  575. `#2364 <https://github.com/pybind/pybind11/pull/2364>`_
  576. * Perfect forwarding support for methods.
  577. `#2048 <https://github.com/pybind/pybind11/pull/2048>`_
  578. * Added ``py::error_already_set::discard_as_unraisable()``.
  579. `#2372 <https://github.com/pybind/pybind11/pull/2372>`_
  580. * ``py::hash`` is now public.
  581. `#2217 <https://github.com/pybind/pybind11/pull/2217>`_
  582. * ``py::class_<union_type>`` is now supported. Note that writing to one data
  583. member of the union and reading another (type punning) is UB in C++. Thus
  584. pybind11-bound enums should never be used for such conversions.
  585. `#2320 <https://github.com/pybind/pybind11/pull/2320>`_.
  586. * Classes now check local scope when registering members, allowing a subclass
  587. to have a member with the same name as a parent (such as an enum).
  588. `#2335 <https://github.com/pybind/pybind11/pull/2335>`_
  589. Code correctness features:
  590. * Error now thrown when ``__init__`` is forgotten on subclasses.
  591. `#2152 <https://github.com/pybind/pybind11/pull/2152>`_
  592. * Throw error if conversion to a pybind11 type if the Python object isn't a
  593. valid instance of that type, such as ``py::bytes(o)`` when ``py::object o``
  594. isn't a bytes instance.
  595. `#2349 <https://github.com/pybind/pybind11/pull/2349>`_
  596. * Throw if conversion to ``str`` fails.
  597. `#2477 <https://github.com/pybind/pybind11/pull/2477>`_
  598. API changes:
  599. * ``py::module`` was renamed ``py::module_`` to avoid issues with C++20 when
  600. used unqualified, but an alias ``py::module`` is provided for backward
  601. compatibility.
  602. `#2489 <https://github.com/pybind/pybind11/pull/2489>`_
  603. * Public constructors for ``py::module_`` have been deprecated; please use
  604. ``pybind11::module_::create_extension_module`` if you were using the public
  605. constructor (fairly rare after ``PYBIND11_MODULE`` was introduced).
  606. `#2552 <https://github.com/pybind/pybind11/pull/2552>`_
  607. * ``PYBIND11_OVERLOAD*`` macros and ``get_overload`` function replaced by
  608. correctly-named ``PYBIND11_OVERRIDE*`` and ``get_override``, fixing
  609. inconsistencies in the presence of a closing ``;`` in these macros.
  610. ``get_type_overload`` is deprecated.
  611. `#2325 <https://github.com/pybind/pybind11/pull/2325>`_
  612. Packaging / building improvements:
  613. * The Python package was reworked to be more powerful and useful.
  614. `#2433 <https://github.com/pybind/pybind11/pull/2433>`_
  615. * :ref:`build-setuptools` is easier thanks to a new
  616. ``pybind11.setup_helpers`` module, which provides utilities to use
  617. setuptools with pybind11. It can be used via PEP 518, ``setup_requires``,
  618. or by directly importing or copying ``setup_helpers.py`` into your project.
  619. * CMake configuration files are now included in the Python package. Use
  620. ``pybind11.get_cmake_dir()`` or ``python -m pybind11 --cmakedir`` to get
  621. the directory with the CMake configuration files, or include the
  622. site-packages location in your ``CMAKE_MODULE_PATH``. Or you can use the
  623. new ``pybind11[global]`` extra when you install ``pybind11``, which
  624. installs the CMake files and headers into your base environment in the
  625. standard location.
  626. * ``pybind11-config`` is another way to write ``python -m pybind11`` if you
  627. have your PATH set up.
  628. * Added external typing support to the helper module, code from
  629. ``import pybind11`` can now be type checked.
  630. `#2588 <https://github.com/pybind/pybind11/pull/2588>`_
  631. * Minimum CMake required increased to 3.4.
  632. `#2338 <https://github.com/pybind/pybind11/pull/2338>`_ and
  633. `#2370 <https://github.com/pybind/pybind11/pull/2370>`_
  634. * Full integration with CMake’s C++ standard system and compile features
  635. replaces ``PYBIND11_CPP_STANDARD``.
  636. * Generated config file is now portable to different Python/compiler/CMake
  637. versions.
  638. * Virtual environments prioritized if ``PYTHON_EXECUTABLE`` is not set
  639. (``venv``, ``virtualenv``, and ``conda``) (similar to the new FindPython
  640. mode).
  641. * Other CMake features now natively supported, like
  642. ``CMAKE_INTERPROCEDURAL_OPTIMIZATION``, ``set(CMAKE_CXX_VISIBILITY_PRESET
  643. hidden)``.
  644. * ``CUDA`` as a language is now supported.
  645. * Helper functions ``pybind11_strip``, ``pybind11_extension``,
  646. ``pybind11_find_import`` added, see :doc:`cmake/index`.
  647. * Optional :ref:`find-python-mode` and :ref:`nopython-mode` with CMake.
  648. `#2370 <https://github.com/pybind/pybind11/pull/2370>`_
  649. * Uninstall target added.
  650. `#2265 <https://github.com/pybind/pybind11/pull/2265>`_ and
  651. `#2346 <https://github.com/pybind/pybind11/pull/2346>`_
  652. * ``pybind11_add_module()`` now accepts an optional ``OPT_SIZE`` flag that
  653. switches the binding target to size-based optimization if the global build
  654. type can not always be fixed to ``MinSizeRel`` (except in debug mode, where
  655. optimizations remain disabled). ``MinSizeRel`` or this flag reduces binary
  656. size quite substantially (~25% on some platforms).
  657. `#2463 <https://github.com/pybind/pybind11/pull/2463>`_
  658. Smaller or developer focused features and fixes:
  659. * Moved ``mkdoc.py`` to a new repo, `pybind11-mkdoc`_. There are no longer
  660. submodules in the main repo.
  661. * ``py::memoryview`` segfault fix and update, with new
  662. ``py::memoryview::from_memory`` in Python 3, and documentation.
  663. `#2223 <https://github.com/pybind/pybind11/pull/2223>`_
  664. * Fix for ``buffer_info`` on Python 2.
  665. `#2503 <https://github.com/pybind/pybind11/pull/2503>`_
  666. * If ``__eq__`` defined but not ``__hash__``, ``__hash__`` is now set to
  667. ``None``.
  668. `#2291 <https://github.com/pybind/pybind11/pull/2291>`_
  669. * ``py::ellipsis`` now also works on Python 2.
  670. `#2360 <https://github.com/pybind/pybind11/pull/2360>`_
  671. * Pointer to ``std::tuple`` & ``std::pair`` supported in cast.
  672. `#2334 <https://github.com/pybind/pybind11/pull/2334>`_
  673. * Small fixes in NumPy support. ``py::array`` now uses ``py::ssize_t`` as first
  674. argument type.
  675. `#2293 <https://github.com/pybind/pybind11/pull/2293>`_
  676. * Added missing signature for ``py::array``.
  677. `#2363 <https://github.com/pybind/pybind11/pull/2363>`_
  678. * ``unchecked_mutable_reference`` has access to operator ``()`` and ``[]`` when
  679. const.
  680. `#2514 <https://github.com/pybind/pybind11/pull/2514>`_
  681. * ``py::vectorize`` is now supported on functions that return void.
  682. `#1969 <https://github.com/pybind/pybind11/pull/1969>`_
  683. * ``py::capsule`` supports ``get_pointer`` and ``set_pointer``.
  684. `#1131 <https://github.com/pybind/pybind11/pull/1131>`_
  685. * Fix crash when different instances share the same pointer of the same type.
  686. `#2252 <https://github.com/pybind/pybind11/pull/2252>`_
  687. * Fix for ``py::len`` not clearing Python's error state when it fails and throws.
  688. `#2575 <https://github.com/pybind/pybind11/pull/2575>`_
  689. * Bugfixes related to more extensive testing, new GitHub Actions CI.
  690. `#2321 <https://github.com/pybind/pybind11/pull/2321>`_
  691. * Bug in timezone issue in Eastern hemisphere midnight fixed.
  692. `#2438 <https://github.com/pybind/pybind11/pull/2438>`_
  693. * ``std::chrono::time_point`` now works when the resolution is not the same as
  694. the system.
  695. `#2481 <https://github.com/pybind/pybind11/pull/2481>`_
  696. * Bug fixed where ``py::array_t`` could accept arrays that did not match the
  697. requested ordering.
  698. `#2484 <https://github.com/pybind/pybind11/pull/2484>`_
  699. * Avoid a segfault on some compilers when types are removed in Python.
  700. `#2564 <https://github.com/pybind/pybind11/pull/2564>`_
  701. * ``py::arg::none()`` is now also respected when passing keyword arguments.
  702. `#2611 <https://github.com/pybind/pybind11/pull/2611>`_
  703. * PyPy fixes, PyPy 7.3.x now supported, including PyPy3. (Known issue with
  704. PyPy2 and Windows `#2596 <https://github.com/pybind/pybind11/issues/2596>`_).
  705. `#2146 <https://github.com/pybind/pybind11/pull/2146>`_
  706. * CPython 3.9.0 workaround for undefined behavior (macOS segfault).
  707. `#2576 <https://github.com/pybind/pybind11/pull/2576>`_
  708. * CPython 3.9 warning fixes.
  709. `#2253 <https://github.com/pybind/pybind11/pull/2253>`_
  710. * Improved C++20 support, now tested in CI.
  711. `#2489 <https://github.com/pybind/pybind11/pull/2489>`_
  712. `#2599 <https://github.com/pybind/pybind11/pull/2599>`_
  713. * Improved but still incomplete debug Python interpreter support.
  714. `#2025 <https://github.com/pybind/pybind11/pull/2025>`_
  715. * NVCC (CUDA 11) now supported and tested in CI.
  716. `#2461 <https://github.com/pybind/pybind11/pull/2461>`_
  717. * NVIDIA PGI compilers now supported and tested in CI.
  718. `#2475 <https://github.com/pybind/pybind11/pull/2475>`_
  719. * At least Intel 18 now explicitly required when compiling with Intel.
  720. `#2577 <https://github.com/pybind/pybind11/pull/2577>`_
  721. * Extensive style checking in CI, with `pre-commit`_ support. Code
  722. modernization, checked by clang-tidy.
  723. * Expanded docs, including new main page, new installing section, and CMake
  724. helpers page, along with over a dozen new sections on existing pages.
  725. * In GitHub, new docs for contributing and new issue templates.
  726. .. _pre-commit: https://pre-commit.com
  727. .. _pybind11-mkdoc: https://github.com/pybind/pybind11-mkdoc
  728. v2.5.0 (Mar 31, 2020)
  729. -----------------------------------------------------
  730. * Use C++17 fold expressions in type casters, if available. This can
  731. improve performance during overload resolution when functions have
  732. multiple arguments.
  733. `#2043 <https://github.com/pybind/pybind11/pull/2043>`_.
  734. * Changed include directory resolution in ``pybind11/__init__.py``
  735. and installation in ``setup.py``. This fixes a number of open issues
  736. where pybind11 headers could not be found in certain environments.
  737. `#1995 <https://github.com/pybind/pybind11/pull/1995>`_.
  738. * C++20 ``char8_t`` and ``u8string`` support. `#2026
  739. <https://github.com/pybind/pybind11/pull/2026>`_.
  740. * CMake: search for Python 3.9. `bb9c91
  741. <https://github.com/pybind/pybind11/commit/bb9c91>`_.
  742. * Fixes for MSYS-based build environments.
  743. `#2087 <https://github.com/pybind/pybind11/pull/2087>`_,
  744. `#2053 <https://github.com/pybind/pybind11/pull/2053>`_.
  745. * STL bindings for ``std::vector<...>::clear``. `#2074
  746. <https://github.com/pybind/pybind11/pull/2074>`_.
  747. * Read-only flag for ``py::buffer``. `#1466
  748. <https://github.com/pybind/pybind11/pull/1466>`_.
  749. * Exception handling during module initialization.
  750. `bf2b031 <https://github.com/pybind/pybind11/commit/bf2b031>`_.
  751. * Support linking against a CPython debug build.
  752. `#2025 <https://github.com/pybind/pybind11/pull/2025>`_.
  753. * Fixed issues involving the availability and use of aligned ``new`` and
  754. ``delete``. `#1988 <https://github.com/pybind/pybind11/pull/1988>`_,
  755. `759221 <https://github.com/pybind/pybind11/commit/759221>`_.
  756. * Fixed a resource leak upon interpreter shutdown.
  757. `#2020 <https://github.com/pybind/pybind11/pull/2020>`_.
  758. * Fixed error handling in the boolean caster.
  759. `#1976 <https://github.com/pybind/pybind11/pull/1976>`_.
  760. v2.4.3 (Oct 15, 2019)
  761. -----------------------------------------------------
  762. * Adapt pybind11 to a C API convention change in Python 3.8. `#1950
  763. <https://github.com/pybind/pybind11/pull/1950>`_.
  764. v2.4.2 (Sep 21, 2019)
  765. -----------------------------------------------------
  766. * Replaced usage of a C++14 only construct. `#1929
  767. <https://github.com/pybind/pybind11/pull/1929>`_.
  768. * Made an ifdef future-proof for Python >= 4. `f3109d
  769. <https://github.com/pybind/pybind11/commit/f3109d>`_.
  770. v2.4.1 (Sep 20, 2019)
  771. -----------------------------------------------------
  772. * Fixed a problem involving implicit conversion from enumerations to integers
  773. on Python 3.8. `#1780 <https://github.com/pybind/pybind11/pull/1780>`_.
  774. v2.4.0 (Sep 19, 2019)
  775. -----------------------------------------------------
  776. * Try harder to keep pybind11-internal data structures separate when there
  777. are potential ABI incompatibilities. Fixes crashes that occurred when loading
  778. multiple pybind11 extensions that were e.g. compiled by GCC (libstdc++)
  779. and Clang (libc++).
  780. `#1588 <https://github.com/pybind/pybind11/pull/1588>`_ and
  781. `c9f5a <https://github.com/pybind/pybind11/commit/c9f5a>`_.
  782. * Added support for ``__await__``, ``__aiter__``, and ``__anext__`` protocols.
  783. `#1842 <https://github.com/pybind/pybind11/pull/1842>`_.
  784. * ``pybind11_add_module()``: don't strip symbols when compiling in
  785. ``RelWithDebInfo`` mode. `#1980
  786. <https://github.com/pybind/pybind11/pull/1980>`_.
  787. * ``enum_``: Reproduce Python behavior when comparing against invalid values
  788. (e.g. ``None``, strings, etc.). Add back support for ``__invert__()``.
  789. `#1912 <https://github.com/pybind/pybind11/pull/1912>`_,
  790. `#1907 <https://github.com/pybind/pybind11/pull/1907>`_.
  791. * List insertion operation for ``py::list``.
  792. Added ``.empty()`` to all collection types.
  793. Added ``py::set::contains()`` and ``py::dict::contains()``.
  794. `#1887 <https://github.com/pybind/pybind11/pull/1887>`_,
  795. `#1884 <https://github.com/pybind/pybind11/pull/1884>`_,
  796. `#1888 <https://github.com/pybind/pybind11/pull/1888>`_.
  797. * ``py::details::overload_cast_impl`` is available in C++11 mode, can be used
  798. like ``overload_cast`` with an additional set of parentheses.
  799. `#1581 <https://github.com/pybind/pybind11/pull/1581>`_.
  800. * Fixed ``get_include()`` on Conda.
  801. `#1877 <https://github.com/pybind/pybind11/pull/1877>`_.
  802. * ``stl_bind.h``: negative indexing support.
  803. `#1882 <https://github.com/pybind/pybind11/pull/1882>`_.
  804. * Minor CMake fix to add MinGW compatibility.
  805. `#1851 <https://github.com/pybind/pybind11/pull/1851>`_.
  806. * GIL-related fixes.
  807. `#1836 <https://github.com/pybind/pybind11/pull/1836>`_,
  808. `8b90b <https://github.com/pybind/pybind11/commit/8b90b>`_.
  809. * Other very minor/subtle fixes and improvements.
  810. `#1329 <https://github.com/pybind/pybind11/pull/1329>`_,
  811. `#1910 <https://github.com/pybind/pybind11/pull/1910>`_,
  812. `#1863 <https://github.com/pybind/pybind11/pull/1863>`_,
  813. `#1847 <https://github.com/pybind/pybind11/pull/1847>`_,
  814. `#1890 <https://github.com/pybind/pybind11/pull/1890>`_,
  815. `#1860 <https://github.com/pybind/pybind11/pull/1860>`_,
  816. `#1848 <https://github.com/pybind/pybind11/pull/1848>`_,
  817. `#1821 <https://github.com/pybind/pybind11/pull/1821>`_,
  818. `#1837 <https://github.com/pybind/pybind11/pull/1837>`_,
  819. `#1833 <https://github.com/pybind/pybind11/pull/1833>`_,
  820. `#1748 <https://github.com/pybind/pybind11/pull/1748>`_,
  821. `#1852 <https://github.com/pybind/pybind11/pull/1852>`_.
  822. v2.3.0 (June 11, 2019)
  823. -----------------------------------------------------
  824. * Significantly reduced module binary size (10-20%) when compiled in C++11 mode
  825. with GCC/Clang, or in any mode with MSVC. Function signatures are now always
  826. precomputed at compile time (this was previously only available in C++14 mode
  827. for non-MSVC compilers).
  828. `#934 <https://github.com/pybind/pybind11/pull/934>`_.
  829. * Add basic support for tag-based static polymorphism, where classes
  830. provide a method to returns the desired type of an instance.
  831. `#1326 <https://github.com/pybind/pybind11/pull/1326>`_.
  832. * Python type wrappers (``py::handle``, ``py::object``, etc.)
  833. now support map Python's number protocol onto C++ arithmetic
  834. operators such as ``operator+``, ``operator/=``, etc.
  835. `#1511 <https://github.com/pybind/pybind11/pull/1511>`_.
  836. * A number of improvements related to enumerations:
  837. 1. The ``enum_`` implementation was rewritten from scratch to reduce
  838. code bloat. Rather than instantiating a full implementation for each
  839. enumeration, most code is now contained in a generic base class.
  840. `#1511 <https://github.com/pybind/pybind11/pull/1511>`_.
  841. 2. The ``value()`` method of ``py::enum_`` now accepts an optional
  842. docstring that will be shown in the documentation of the associated
  843. enumeration. `#1160 <https://github.com/pybind/pybind11/pull/1160>`_.
  844. 3. check for already existing enum value and throw an error if present.
  845. `#1453 <https://github.com/pybind/pybind11/pull/1453>`_.
  846. * Support for over-aligned type allocation via C++17's aligned ``new``
  847. statement. `#1582 <https://github.com/pybind/pybind11/pull/1582>`_.
  848. * Added ``py::ellipsis()`` method for slicing of multidimensional NumPy arrays
  849. `#1502 <https://github.com/pybind/pybind11/pull/1502>`_.
  850. * Numerous Improvements to the ``mkdoc.py`` script for extracting documentation
  851. from C++ header files.
  852. `#1788 <https://github.com/pybind/pybind11/pull/1788>`_.
  853. * ``pybind11_add_module()``: allow including Python as a ``SYSTEM`` include path.
  854. `#1416 <https://github.com/pybind/pybind11/pull/1416>`_.
  855. * ``pybind11/stl.h`` does not convert strings to ``vector<string>`` anymore.
  856. `#1258 <https://github.com/pybind/pybind11/issues/1258>`_.
  857. * Mark static methods as such to fix auto-generated Sphinx documentation.
  858. `#1732 <https://github.com/pybind/pybind11/pull/1732>`_.
  859. * Re-throw forced unwind exceptions (e.g. during pthread termination).
  860. `#1208 <https://github.com/pybind/pybind11/pull/1208>`_.
  861. * Added ``__contains__`` method to the bindings of maps (``std::map``,
  862. ``std::unordered_map``).
  863. `#1767 <https://github.com/pybind/pybind11/pull/1767>`_.
  864. * Improvements to ``gil_scoped_acquire``.
  865. `#1211 <https://github.com/pybind/pybind11/pull/1211>`_.
  866. * Type caster support for ``std::deque<T>``.
  867. `#1609 <https://github.com/pybind/pybind11/pull/1609>`_.
  868. * Support for ``std::unique_ptr`` holders, whose deleters differ between a base and derived
  869. class. `#1353 <https://github.com/pybind/pybind11/pull/1353>`_.
  870. * Construction of STL array/vector-like data structures from
  871. iterators. Added an ``extend()`` operation.
  872. `#1709 <https://github.com/pybind/pybind11/pull/1709>`_,
  873. * CMake build system improvements for projects that include non-C++
  874. files (e.g. plain C, CUDA) in ``pybind11_add_module`` et al.
  875. `#1678 <https://github.com/pybind/pybind11/pull/1678>`_.
  876. * Fixed asynchronous invocation and deallocation of Python functions
  877. wrapped in ``std::function``.
  878. `#1595 <https://github.com/pybind/pybind11/pull/1595>`_.
  879. * Fixes regarding return value policy propagation in STL type casters.
  880. `#1603 <https://github.com/pybind/pybind11/pull/1603>`_.
  881. * Fixed scoped enum comparisons.
  882. `#1571 <https://github.com/pybind/pybind11/pull/1571>`_.
  883. * Fixed iostream redirection for code that releases the GIL.
  884. `#1368 <https://github.com/pybind/pybind11/pull/1368>`_,
  885. * A number of CI-related fixes.
  886. `#1757 <https://github.com/pybind/pybind11/pull/1757>`_,
  887. `#1744 <https://github.com/pybind/pybind11/pull/1744>`_,
  888. `#1670 <https://github.com/pybind/pybind11/pull/1670>`_.
  889. v2.2.4 (September 11, 2018)
  890. -----------------------------------------------------
  891. * Use new Python 3.7 Thread Specific Storage (TSS) implementation if available.
  892. `#1454 <https://github.com/pybind/pybind11/pull/1454>`_,
  893. `#1517 <https://github.com/pybind/pybind11/pull/1517>`_.
  894. * Fixes for newer MSVC versions and C++17 mode.
  895. `#1347 <https://github.com/pybind/pybind11/pull/1347>`_,
  896. `#1462 <https://github.com/pybind/pybind11/pull/1462>`_.
  897. * Propagate return value policies to type-specific casters
  898. when casting STL containers.
  899. `#1455 <https://github.com/pybind/pybind11/pull/1455>`_.
  900. * Allow ostream-redirection of more than 1024 characters.
  901. `#1479 <https://github.com/pybind/pybind11/pull/1479>`_.
  902. * Set ``Py_DEBUG`` define when compiling against a debug Python build.
  903. `#1438 <https://github.com/pybind/pybind11/pull/1438>`_.
  904. * Untangle integer logic in number type caster to work for custom
  905. types that may only be castable to a restricted set of builtin types.
  906. `#1442 <https://github.com/pybind/pybind11/pull/1442>`_.
  907. * CMake build system: Remember Python version in cache file.
  908. `#1434 <https://github.com/pybind/pybind11/pull/1434>`_.
  909. * Fix for custom smart pointers: use ``std::addressof`` to obtain holder
  910. address instead of ``operator&``.
  911. `#1435 <https://github.com/pybind/pybind11/pull/1435>`_.
  912. * Properly report exceptions thrown during module initialization.
  913. `#1362 <https://github.com/pybind/pybind11/pull/1362>`_.
  914. * Fixed a segmentation fault when creating empty-shaped NumPy array.
  915. `#1371 <https://github.com/pybind/pybind11/pull/1371>`_.
  916. * The version of Intel C++ compiler must be >= 2017, and this is now checked by
  917. the header files. `#1363 <https://github.com/pybind/pybind11/pull/1363>`_.
  918. * A few minor typo fixes and improvements to the test suite, and
  919. patches that silence compiler warnings.
  920. * Vectors now support construction from generators, as well as ``extend()`` from a
  921. list or generator.
  922. `#1496 <https://github.com/pybind/pybind11/pull/1496>`_.
  923. v2.2.3 (April 29, 2018)
  924. -----------------------------------------------------
  925. * The pybind11 header location detection was replaced by a new implementation
  926. that no longer depends on ``pip`` internals (the recently released ``pip``
  927. 10 has restricted access to this API).
  928. `#1190 <https://github.com/pybind/pybind11/pull/1190>`_.
  929. * Small adjustment to an implementation detail to work around a compiler segmentation fault in Clang 3.3/3.4.
  930. `#1350 <https://github.com/pybind/pybind11/pull/1350>`_.
  931. * The minimal supported version of the Intel compiler was >= 17.0 since
  932. pybind11 v2.1. This check is now explicit, and a compile-time error is raised
  933. if the compiler meet the requirement.
  934. `#1363 <https://github.com/pybind/pybind11/pull/1363>`_.
  935. * Fixed an endianness-related fault in the test suite.
  936. `#1287 <https://github.com/pybind/pybind11/pull/1287>`_.
  937. v2.2.2 (February 7, 2018)
  938. -----------------------------------------------------
  939. * Fixed a segfault when combining embedded interpreter
  940. shutdown/reinitialization with external loaded pybind11 modules.
  941. `#1092 <https://github.com/pybind/pybind11/pull/1092>`_.
  942. * Eigen support: fixed a bug where Nx1/1xN numpy inputs couldn't be passed as
  943. arguments to Eigen vectors (which for Eigen are simply compile-time fixed
  944. Nx1/1xN matrices).
  945. `#1106 <https://github.com/pybind/pybind11/pull/1106>`_.
  946. * Clarified to license by moving the licensing of contributions from
  947. ``LICENSE`` into ``CONTRIBUTING.md``: the licensing of contributions is not
  948. actually part of the software license as distributed. This isn't meant to be
  949. a substantial change in the licensing of the project, but addresses concerns
  950. that the clause made the license non-standard.
  951. `#1109 <https://github.com/pybind/pybind11/issues/1109>`_.
  952. * Fixed a regression introduced in 2.1 that broke binding functions with lvalue
  953. character literal arguments.
  954. `#1128 <https://github.com/pybind/pybind11/pull/1128>`_.
  955. * MSVC: fix for compilation failures under /permissive-, and added the flag to
  956. the appveyor test suite.
  957. `#1155 <https://github.com/pybind/pybind11/pull/1155>`_.
  958. * Fixed ``__qualname__`` generation, and in turn, fixes how class names
  959. (especially nested class names) are shown in generated docstrings.
  960. `#1171 <https://github.com/pybind/pybind11/pull/1171>`_.
  961. * Updated the FAQ with a suggested project citation reference.
  962. `#1189 <https://github.com/pybind/pybind11/pull/1189>`_.
  963. * Added fixes for deprecation warnings when compiled under C++17 with
  964. ``-Wdeprecated`` turned on, and add ``-Wdeprecated`` to the test suite
  965. compilation flags.
  966. `#1191 <https://github.com/pybind/pybind11/pull/1191>`_.
  967. * Fixed outdated PyPI URLs in ``setup.py``.
  968. `#1213 <https://github.com/pybind/pybind11/pull/1213>`_.
  969. * Fixed a refcount leak for arguments that end up in a ``py::args`` argument
  970. for functions with both fixed positional and ``py::args`` arguments.
  971. `#1216 <https://github.com/pybind/pybind11/pull/1216>`_.
  972. * Fixed a potential segfault resulting from possible premature destruction of
  973. ``py::args``/``py::kwargs`` arguments with overloaded functions.
  974. `#1223 <https://github.com/pybind/pybind11/pull/1223>`_.
  975. * Fixed ``del map[item]`` for a ``stl_bind.h`` bound stl map.
  976. `#1229 <https://github.com/pybind/pybind11/pull/1229>`_.
  977. * Fixed a regression from v2.1.x where the aggregate initialization could
  978. unintentionally end up at a constructor taking a templated
  979. ``std::initializer_list<T>`` argument.
  980. `#1249 <https://github.com/pybind/pybind11/pull/1249>`_.
  981. * Fixed an issue where calling a function with a keep_alive policy on the same
  982. nurse/patient pair would cause the internal patient storage to needlessly
  983. grow (unboundedly, if the nurse is long-lived).
  984. `#1251 <https://github.com/pybind/pybind11/issues/1251>`_.
  985. * Various other minor fixes.
  986. v2.2.1 (September 14, 2017)
  987. -----------------------------------------------------
  988. * Added ``py::module_::reload()`` member function for reloading a module.
  989. `#1040 <https://github.com/pybind/pybind11/pull/1040>`_.
  990. * Fixed a reference leak in the number converter.
  991. `#1078 <https://github.com/pybind/pybind11/pull/1078>`_.
  992. * Fixed compilation with Clang on host GCC < 5 (old libstdc++ which isn't fully
  993. C++11 compliant). `#1062 <https://github.com/pybind/pybind11/pull/1062>`_.
  994. * Fixed a regression where the automatic ``std::vector<bool>`` caster would
  995. fail to compile. The same fix also applies to any container which returns
  996. element proxies instead of references.
  997. `#1053 <https://github.com/pybind/pybind11/pull/1053>`_.
  998. * Fixed a regression where the ``py::keep_alive`` policy could not be applied
  999. to constructors. `#1065 <https://github.com/pybind/pybind11/pull/1065>`_.
  1000. * Fixed a nullptr dereference when loading a ``py::module_local`` type
  1001. that's only registered in an external module.
  1002. `#1058 <https://github.com/pybind/pybind11/pull/1058>`_.
  1003. * Fixed implicit conversion of accessors to types derived from ``py::object``.
  1004. `#1076 <https://github.com/pybind/pybind11/pull/1076>`_.
  1005. * The ``name`` in ``PYBIND11_MODULE(name, variable)`` can now be a macro.
  1006. `#1082 <https://github.com/pybind/pybind11/pull/1082>`_.
  1007. * Relaxed overly strict ``py::pickle()`` check for matching get and set types.
  1008. `#1064 <https://github.com/pybind/pybind11/pull/1064>`_.
  1009. * Conversion errors now try to be more informative when it's likely that
  1010. a missing header is the cause (e.g. forgetting ``<pybind11/stl.h>``).
  1011. `#1077 <https://github.com/pybind/pybind11/pull/1077>`_.
  1012. v2.2.0 (August 31, 2017)
  1013. -----------------------------------------------------
  1014. * Support for embedding the Python interpreter. See the
  1015. :doc:`documentation page </advanced/embedding>` for a
  1016. full overview of the new features.
  1017. `#774 <https://github.com/pybind/pybind11/pull/774>`_,
  1018. `#889 <https://github.com/pybind/pybind11/pull/889>`_,
  1019. `#892 <https://github.com/pybind/pybind11/pull/892>`_,
  1020. `#920 <https://github.com/pybind/pybind11/pull/920>`_.
  1021. .. code-block:: cpp
  1022. #include <pybind11/embed.h>
  1023. namespace py = pybind11;
  1024. int main() {
  1025. py::scoped_interpreter guard{}; // start the interpreter and keep it alive
  1026. py::print("Hello, World!"); // use the Python API
  1027. }
  1028. * Support for inheriting from multiple C++ bases in Python.
  1029. `#693 <https://github.com/pybind/pybind11/pull/693>`_.
  1030. .. code-block:: python
  1031. from cpp_module import CppBase1, CppBase2
  1032. class PyDerived(CppBase1, CppBase2):
  1033. def __init__(self):
  1034. CppBase1.__init__(self) # C++ bases must be initialized explicitly
  1035. CppBase2.__init__(self)
  1036. * ``PYBIND11_MODULE`` is now the preferred way to create module entry points.
  1037. ``PYBIND11_PLUGIN`` is deprecated. See :ref:`macros` for details.
  1038. `#879 <https://github.com/pybind/pybind11/pull/879>`_.
  1039. .. code-block:: cpp
  1040. // new
  1041. PYBIND11_MODULE(example, m) {
  1042. m.def("add", [](int a, int b) { return a + b; });
  1043. }
  1044. // old
  1045. PYBIND11_PLUGIN(example) {
  1046. py::module m("example");
  1047. m.def("add", [](int a, int b) { return a + b; });
  1048. return m.ptr();
  1049. }
  1050. * pybind11's headers and build system now more strictly enforce hidden symbol
  1051. visibility for extension modules. This should be seamless for most users,
  1052. but see the :doc:`upgrade` if you use a custom build system.
  1053. `#995 <https://github.com/pybind/pybind11/pull/995>`_.
  1054. * Support for ``py::module_local`` types which allow multiple modules to
  1055. export the same C++ types without conflicts. This is useful for opaque
  1056. types like ``std::vector<int>``. ``py::bind_vector`` and ``py::bind_map``
  1057. now default to ``py::module_local`` if their elements are builtins or
  1058. local types. See :ref:`module_local` for details.
  1059. `#949 <https://github.com/pybind/pybind11/pull/949>`_,
  1060. `#981 <https://github.com/pybind/pybind11/pull/981>`_,
  1061. `#995 <https://github.com/pybind/pybind11/pull/995>`_,
  1062. `#997 <https://github.com/pybind/pybind11/pull/997>`_.
  1063. * Custom constructors can now be added very easily using lambdas or factory
  1064. functions which return a class instance by value, pointer or holder. This
  1065. supersedes the old placement-new ``__init__`` technique.
  1066. See :ref:`custom_constructors` for details.
  1067. `#805 <https://github.com/pybind/pybind11/pull/805>`_,
  1068. `#1014 <https://github.com/pybind/pybind11/pull/1014>`_.
  1069. .. code-block:: cpp
  1070. struct Example {
  1071. Example(std::string);
  1072. };
  1073. py::class_<Example>(m, "Example")
  1074. .def(py::init<std::string>()) // existing constructor
  1075. .def(py::init([](int n) { // custom constructor
  1076. return std::make_unique<Example>(std::to_string(n));
  1077. }));
  1078. * Similarly to custom constructors, pickling support functions are now bound
  1079. using the ``py::pickle()`` adaptor which improves type safety. See the
  1080. :doc:`upgrade` and :ref:`pickling` for details.
  1081. `#1038 <https://github.com/pybind/pybind11/pull/1038>`_.
  1082. * Builtin support for converting C++17 standard library types and general
  1083. conversion improvements:
  1084. 1. C++17 ``std::variant`` is supported right out of the box. C++11/14
  1085. equivalents (e.g. ``boost::variant``) can also be added with a simple
  1086. user-defined specialization. See :ref:`cpp17_container_casters` for details.
  1087. `#811 <https://github.com/pybind/pybind11/pull/811>`_,
  1088. `#845 <https://github.com/pybind/pybind11/pull/845>`_,
  1089. `#989 <https://github.com/pybind/pybind11/pull/989>`_.
  1090. 2. Out-of-the-box support for C++17 ``std::string_view``.
  1091. `#906 <https://github.com/pybind/pybind11/pull/906>`_.
  1092. 3. Improved compatibility of the builtin ``optional`` converter.
  1093. `#874 <https://github.com/pybind/pybind11/pull/874>`_.
  1094. 4. The ``bool`` converter now accepts ``numpy.bool_`` and types which
  1095. define ``__bool__`` (Python 3.x) or ``__nonzero__`` (Python 2.7).
  1096. `#925 <https://github.com/pybind/pybind11/pull/925>`_.
  1097. 5. C++-to-Python casters are now more efficient and move elements out
  1098. of rvalue containers whenever possible.
  1099. `#851 <https://github.com/pybind/pybind11/pull/851>`_,
  1100. `#936 <https://github.com/pybind/pybind11/pull/936>`_,
  1101. `#938 <https://github.com/pybind/pybind11/pull/938>`_.
  1102. 6. Fixed ``bytes`` to ``std::string/char*`` conversion on Python 3.
  1103. `#817 <https://github.com/pybind/pybind11/pull/817>`_.
  1104. 7. Fixed lifetime of temporary C++ objects created in Python-to-C++ conversions.
  1105. `#924 <https://github.com/pybind/pybind11/pull/924>`_.
  1106. * Scope guard call policy for RAII types, e.g. ``py::call_guard<py::gil_scoped_release>()``,
  1107. ``py::call_guard<py::scoped_ostream_redirect>()``. See :ref:`call_policies` for details.
  1108. `#740 <https://github.com/pybind/pybind11/pull/740>`_.
  1109. * Utility for redirecting C++ streams to Python (e.g. ``std::cout`` ->
  1110. ``sys.stdout``). Scope guard ``py::scoped_ostream_redirect`` in C++ and
  1111. a context manager in Python. See :ref:`ostream_redirect`.
  1112. `#1009 <https://github.com/pybind/pybind11/pull/1009>`_.
  1113. * Improved handling of types and exceptions across module boundaries.
  1114. `#915 <https://github.com/pybind/pybind11/pull/915>`_,
  1115. `#951 <https://github.com/pybind/pybind11/pull/951>`_,
  1116. `#995 <https://github.com/pybind/pybind11/pull/995>`_.
  1117. * Fixed destruction order of ``py::keep_alive`` nurse/patient objects
  1118. in reference cycles.
  1119. `#856 <https://github.com/pybind/pybind11/pull/856>`_.
  1120. * NumPy and buffer protocol related improvements:
  1121. 1. Support for negative strides in Python buffer objects/numpy arrays. This
  1122. required changing integers from unsigned to signed for the related C++ APIs.
  1123. Note: If you have compiler warnings enabled, you may notice some new conversion
  1124. warnings after upgrading. These can be resolved with ``static_cast``.
  1125. `#782 <https://github.com/pybind/pybind11/pull/782>`_.
  1126. 2. Support ``std::complex`` and arrays inside ``PYBIND11_NUMPY_DTYPE``.
  1127. `#831 <https://github.com/pybind/pybind11/pull/831>`_,
  1128. `#832 <https://github.com/pybind/pybind11/pull/832>`_.
  1129. 3. Support for constructing ``py::buffer_info`` and ``py::arrays`` using
  1130. arbitrary containers or iterators instead of requiring a ``std::vector``.
  1131. `#788 <https://github.com/pybind/pybind11/pull/788>`_,
  1132. `#822 <https://github.com/pybind/pybind11/pull/822>`_,
  1133. `#860 <https://github.com/pybind/pybind11/pull/860>`_.
  1134. 4. Explicitly check numpy version and require >= 1.7.0.
  1135. `#819 <https://github.com/pybind/pybind11/pull/819>`_.
  1136. * Support for allowing/prohibiting ``None`` for specific arguments and improved
  1137. ``None`` overload resolution order. See :ref:`none_arguments` for details.
  1138. `#843 <https://github.com/pybind/pybind11/pull/843>`_.
  1139. `#859 <https://github.com/pybind/pybind11/pull/859>`_.
  1140. * Added ``py::exec()`` as a shortcut for ``py::eval<py::eval_statements>()``
  1141. and support for C++11 raw string literals as input. See :ref:`eval`.
  1142. `#766 <https://github.com/pybind/pybind11/pull/766>`_,
  1143. `#827 <https://github.com/pybind/pybind11/pull/827>`_.
  1144. * ``py::vectorize()`` ignores non-vectorizable arguments and supports
  1145. member functions.
  1146. `#762 <https://github.com/pybind/pybind11/pull/762>`_.
  1147. * Support for bound methods as callbacks (``pybind11/functional.h``).
  1148. `#815 <https://github.com/pybind/pybind11/pull/815>`_.
  1149. * Allow aliasing pybind11 methods: ``cls.attr("foo") = cls.attr("bar")``.
  1150. `#802 <https://github.com/pybind/pybind11/pull/802>`_.
  1151. * Don't allow mixed static/non-static overloads.
  1152. `#804 <https://github.com/pybind/pybind11/pull/804>`_.
  1153. * Fixed overriding static properties in derived classes.
  1154. `#784 <https://github.com/pybind/pybind11/pull/784>`_.
  1155. * Added support for write only properties.
  1156. `#1144 <https://github.com/pybind/pybind11/pull/1144>`_.
  1157. * Improved deduction of member functions of a derived class when its bases
  1158. aren't registered with pybind11.
  1159. `#855 <https://github.com/pybind/pybind11/pull/855>`_.
  1160. .. code-block:: cpp
  1161. struct Base {
  1162. int foo() { return 42; }
  1163. }
  1164. struct Derived : Base {}
  1165. // Now works, but previously required also binding `Base`
  1166. py::class_<Derived>(m, "Derived")
  1167. .def("foo", &Derived::foo); // function is actually from `Base`
  1168. * The implementation of ``py::init<>`` now uses C++11 brace initialization
  1169. syntax to construct instances, which permits binding implicit constructors of
  1170. aggregate types. `#1015 <https://github.com/pybind/pybind11/pull/1015>`_.
  1171. .. code-block:: cpp
  1172. struct Aggregate {
  1173. int a;
  1174. std::string b;
  1175. };
  1176. py::class_<Aggregate>(m, "Aggregate")
  1177. .def(py::init<int, const std::string &>());
  1178. * Fixed issues with multiple inheritance with offset base/derived pointers.
  1179. `#812 <https://github.com/pybind/pybind11/pull/812>`_,
  1180. `#866 <https://github.com/pybind/pybind11/pull/866>`_,
  1181. `#960 <https://github.com/pybind/pybind11/pull/960>`_.
  1182. * Fixed reference leak of type objects.
  1183. `#1030 <https://github.com/pybind/pybind11/pull/1030>`_.
  1184. * Improved support for the ``/std:c++14`` and ``/std:c++latest`` modes
  1185. on MSVC 2017.
  1186. `#841 <https://github.com/pybind/pybind11/pull/841>`_,
  1187. `#999 <https://github.com/pybind/pybind11/pull/999>`_.
  1188. * Fixed detection of private operator new on MSVC.
  1189. `#893 <https://github.com/pybind/pybind11/pull/893>`_,
  1190. `#918 <https://github.com/pybind/pybind11/pull/918>`_.
  1191. * Intel C++ compiler compatibility fixes.
  1192. `#937 <https://github.com/pybind/pybind11/pull/937>`_.
  1193. * Fixed implicit conversion of ``py::enum_`` to integer types on Python 2.7.
  1194. `#821 <https://github.com/pybind/pybind11/pull/821>`_.
  1195. * Added ``py::hash`` to fetch the hash value of Python objects, and
  1196. ``.def(hash(py::self))`` to provide the C++ ``std::hash`` as the Python
  1197. ``__hash__`` method.
  1198. `#1034 <https://github.com/pybind/pybind11/pull/1034>`_.
  1199. * Fixed ``__truediv__`` on Python 2 and ``__itruediv__`` on Python 3.
  1200. `#867 <https://github.com/pybind/pybind11/pull/867>`_.
  1201. * ``py::capsule`` objects now support the ``name`` attribute. This is useful
  1202. for interfacing with ``scipy.LowLevelCallable``.
  1203. `#902 <https://github.com/pybind/pybind11/pull/902>`_.
  1204. * Fixed ``py::make_iterator``'s ``__next__()`` for past-the-end calls.
  1205. `#897 <https://github.com/pybind/pybind11/pull/897>`_.
  1206. * Added ``error_already_set::matches()`` for checking Python exceptions.
  1207. `#772 <https://github.com/pybind/pybind11/pull/772>`_.
  1208. * Deprecated ``py::error_already_set::clear()``. It's no longer needed
  1209. following a simplification of the ``py::error_already_set`` class.
  1210. `#954 <https://github.com/pybind/pybind11/pull/954>`_.
  1211. * Deprecated ``py::handle::operator==()`` in favor of ``py::handle::is()``
  1212. `#825 <https://github.com/pybind/pybind11/pull/825>`_.
  1213. * Deprecated ``py::object::borrowed``/``py::object::stolen``.
  1214. Use ``py::object::borrowed_t{}``/``py::object::stolen_t{}`` instead.
  1215. `#771 <https://github.com/pybind/pybind11/pull/771>`_.
  1216. * Changed internal data structure versioning to avoid conflicts between
  1217. modules compiled with different revisions of pybind11.
  1218. `#1012 <https://github.com/pybind/pybind11/pull/1012>`_.
  1219. * Additional compile-time and run-time error checking and more informative messages.
  1220. `#786 <https://github.com/pybind/pybind11/pull/786>`_,
  1221. `#794 <https://github.com/pybind/pybind11/pull/794>`_,
  1222. `#803 <https://github.com/pybind/pybind11/pull/803>`_.
  1223. * Various minor improvements and fixes.
  1224. `#764 <https://github.com/pybind/pybind11/pull/764>`_,
  1225. `#791 <https://github.com/pybind/pybind11/pull/791>`_,
  1226. `#795 <https://github.com/pybind/pybind11/pull/795>`_,
  1227. `#840 <https://github.com/pybind/pybind11/pull/840>`_,
  1228. `#844 <https://github.com/pybind/pybind11/pull/844>`_,
  1229. `#846 <https://github.com/pybind/pybind11/pull/846>`_,
  1230. `#849 <https://github.com/pybind/pybind11/pull/849>`_,
  1231. `#858 <https://github.com/pybind/pybind11/pull/858>`_,
  1232. `#862 <https://github.com/pybind/pybind11/pull/862>`_,
  1233. `#871 <https://github.com/pybind/pybind11/pull/871>`_,
  1234. `#872 <https://github.com/pybind/pybind11/pull/872>`_,
  1235. `#881 <https://github.com/pybind/pybind11/pull/881>`_,
  1236. `#888 <https://github.com/pybind/pybind11/pull/888>`_,
  1237. `#899 <https://github.com/pybind/pybind11/pull/899>`_,
  1238. `#928 <https://github.com/pybind/pybind11/pull/928>`_,
  1239. `#931 <https://github.com/pybind/pybind11/pull/931>`_,
  1240. `#944 <https://github.com/pybind/pybind11/pull/944>`_,
  1241. `#950 <https://github.com/pybind/pybind11/pull/950>`_,
  1242. `#952 <https://github.com/pybind/pybind11/pull/952>`_,
  1243. `#962 <https://github.com/pybind/pybind11/pull/962>`_,
  1244. `#965 <https://github.com/pybind/pybind11/pull/965>`_,
  1245. `#970 <https://github.com/pybind/pybind11/pull/970>`_,
  1246. `#978 <https://github.com/pybind/pybind11/pull/978>`_,
  1247. `#979 <https://github.com/pybind/pybind11/pull/979>`_,
  1248. `#986 <https://github.com/pybind/pybind11/pull/986>`_,
  1249. `#1020 <https://github.com/pybind/pybind11/pull/1020>`_,
  1250. `#1027 <https://github.com/pybind/pybind11/pull/1027>`_,
  1251. `#1037 <https://github.com/pybind/pybind11/pull/1037>`_.
  1252. * Testing improvements.
  1253. `#798 <https://github.com/pybind/pybind11/pull/798>`_,
  1254. `#882 <https://github.com/pybind/pybind11/pull/882>`_,
  1255. `#898 <https://github.com/pybind/pybind11/pull/898>`_,
  1256. `#900 <https://github.com/pybind/pybind11/pull/900>`_,
  1257. `#921 <https://github.com/pybind/pybind11/pull/921>`_,
  1258. `#923 <https://github.com/pybind/pybind11/pull/923>`_,
  1259. `#963 <https://github.com/pybind/pybind11/pull/963>`_.
  1260. v2.1.1 (April 7, 2017)
  1261. -----------------------------------------------------
  1262. * Fixed minimum version requirement for MSVC 2015u3
  1263. `#773 <https://github.com/pybind/pybind11/pull/773>`_.
  1264. v2.1.0 (March 22, 2017)
  1265. -----------------------------------------------------
  1266. * pybind11 now performs function overload resolution in two phases. The first
  1267. phase only considers exact type matches, while the second allows for implicit
  1268. conversions to take place. A special ``noconvert()`` syntax can be used to
  1269. completely disable implicit conversions for specific arguments.
  1270. `#643 <https://github.com/pybind/pybind11/pull/643>`_,
  1271. `#634 <https://github.com/pybind/pybind11/pull/634>`_,
  1272. `#650 <https://github.com/pybind/pybind11/pull/650>`_.
  1273. * Fixed a regression where static properties no longer worked with classes
  1274. using multiple inheritance. The ``py::metaclass`` attribute is no longer
  1275. necessary (and deprecated as of this release) when binding classes with
  1276. static properties.
  1277. `#679 <https://github.com/pybind/pybind11/pull/679>`_,
  1278. * Classes bound using ``pybind11`` can now use custom metaclasses.
  1279. `#679 <https://github.com/pybind/pybind11/pull/679>`_,
  1280. * ``py::args`` and ``py::kwargs`` can now be mixed with other positional
  1281. arguments when binding functions using pybind11.
  1282. `#611 <https://github.com/pybind/pybind11/pull/611>`_.
  1283. * Improved support for C++11 unicode string and character types; added
  1284. extensive documentation regarding pybind11's string conversion behavior.
  1285. `#624 <https://github.com/pybind/pybind11/pull/624>`_,
  1286. `#636 <https://github.com/pybind/pybind11/pull/636>`_,
  1287. `#715 <https://github.com/pybind/pybind11/pull/715>`_.
  1288. * pybind11 can now avoid expensive copies when converting Eigen arrays to NumPy
  1289. arrays (and vice versa). `#610 <https://github.com/pybind/pybind11/pull/610>`_.
  1290. * The "fast path" in ``py::vectorize`` now works for any full-size group of C or
  1291. F-contiguous arrays. The non-fast path is also faster since it no longer performs
  1292. copies of the input arguments (except when type conversions are necessary).
  1293. `#610 <https://github.com/pybind/pybind11/pull/610>`_.
  1294. * Added fast, unchecked access to NumPy arrays via a proxy object.
  1295. `#746 <https://github.com/pybind/pybind11/pull/746>`_.
  1296. * Transparent support for class-specific ``operator new`` and
  1297. ``operator delete`` implementations.
  1298. `#755 <https://github.com/pybind/pybind11/pull/755>`_.
  1299. * Slimmer and more efficient STL-compatible iterator interface for sequence types.
  1300. `#662 <https://github.com/pybind/pybind11/pull/662>`_.
  1301. * Improved custom holder type support.
  1302. `#607 <https://github.com/pybind/pybind11/pull/607>`_.
  1303. * ``nullptr`` to ``None`` conversion fixed in various builtin type casters.
  1304. `#732 <https://github.com/pybind/pybind11/pull/732>`_.
  1305. * ``enum_`` now exposes its members via a special ``__members__`` attribute.
  1306. `#666 <https://github.com/pybind/pybind11/pull/666>`_.
  1307. * ``std::vector`` bindings created using ``stl_bind.h`` can now optionally
  1308. implement the buffer protocol. `#488 <https://github.com/pybind/pybind11/pull/488>`_.
  1309. * Automated C++ reference documentation using doxygen and breathe.
  1310. `#598 <https://github.com/pybind/pybind11/pull/598>`_.
  1311. * Added minimum compiler version assertions.
  1312. `#727 <https://github.com/pybind/pybind11/pull/727>`_.
  1313. * Improved compatibility with C++1z.
  1314. `#677 <https://github.com/pybind/pybind11/pull/677>`_.
  1315. * Improved ``py::capsule`` API. Can be used to implement cleanup
  1316. callbacks that are involved at module destruction time.
  1317. `#752 <https://github.com/pybind/pybind11/pull/752>`_.
  1318. * Various minor improvements and fixes.
  1319. `#595 <https://github.com/pybind/pybind11/pull/595>`_,
  1320. `#588 <https://github.com/pybind/pybind11/pull/588>`_,
  1321. `#589 <https://github.com/pybind/pybind11/pull/589>`_,
  1322. `#603 <https://github.com/pybind/pybind11/pull/603>`_,
  1323. `#619 <https://github.com/pybind/pybind11/pull/619>`_,
  1324. `#648 <https://github.com/pybind/pybind11/pull/648>`_,
  1325. `#695 <https://github.com/pybind/pybind11/pull/695>`_,
  1326. `#720 <https://github.com/pybind/pybind11/pull/720>`_,
  1327. `#723 <https://github.com/pybind/pybind11/pull/723>`_,
  1328. `#729 <https://github.com/pybind/pybind11/pull/729>`_,
  1329. `#724 <https://github.com/pybind/pybind11/pull/724>`_,
  1330. `#742 <https://github.com/pybind/pybind11/pull/742>`_,
  1331. `#753 <https://github.com/pybind/pybind11/pull/753>`_.
  1332. v2.0.1 (Jan 4, 2017)
  1333. -----------------------------------------------------
  1334. * Fix pointer to reference error in type_caster on MSVC
  1335. `#583 <https://github.com/pybind/pybind11/pull/583>`_.
  1336. * Fixed a segmentation in the test suite due to a typo
  1337. `cd7eac <https://github.com/pybind/pybind11/commit/cd7eac>`_.
  1338. v2.0.0 (Jan 1, 2017)
  1339. -----------------------------------------------------
  1340. * Fixed a reference counting regression affecting types with custom metaclasses
  1341. (introduced in v2.0.0-rc1).
  1342. `#571 <https://github.com/pybind/pybind11/pull/571>`_.
  1343. * Quenched a CMake policy warning.
  1344. `#570 <https://github.com/pybind/pybind11/pull/570>`_.
  1345. v2.0.0-rc1 (Dec 23, 2016)
  1346. -----------------------------------------------------
  1347. The pybind11 developers are excited to issue a release candidate of pybind11
  1348. with a subsequent v2.0.0 release planned in early January next year.
  1349. An incredible amount of effort by went into pybind11 over the last ~5 months,
  1350. leading to a release that is jam-packed with exciting new features and numerous
  1351. usability improvements. The following list links PRs or individual commits
  1352. whenever applicable.
  1353. Happy Christmas!
  1354. * Support for binding C++ class hierarchies that make use of multiple
  1355. inheritance. `#410 <https://github.com/pybind/pybind11/pull/410>`_.
  1356. * PyPy support: pybind11 now supports nightly builds of PyPy and will
  1357. interoperate with the future 5.7 release. No code changes are necessary,
  1358. everything "just" works as usual. Note that we only target the Python 2.7
  1359. branch for now; support for 3.x will be added once its ``cpyext`` extension
  1360. support catches up. A few minor features remain unsupported for the time
  1361. being (notably dynamic attributes in custom types).
  1362. `#527 <https://github.com/pybind/pybind11/pull/527>`_.
  1363. * Significant work on the documentation -- in particular, the monolithic
  1364. ``advanced.rst`` file was restructured into a easier to read hierarchical
  1365. organization. `#448 <https://github.com/pybind/pybind11/pull/448>`_.
  1366. * Many NumPy-related improvements:
  1367. 1. Object-oriented API to access and modify NumPy ``ndarray`` instances,
  1368. replicating much of the corresponding NumPy C API functionality.
  1369. `#402 <https://github.com/pybind/pybind11/pull/402>`_.
  1370. 2. NumPy array ``dtype`` array descriptors are now first-class citizens and
  1371. are exposed via a new class ``py::dtype``.
  1372. 3. Structured dtypes can be registered using the ``PYBIND11_NUMPY_DTYPE()``
  1373. macro. Special ``array`` constructors accepting dtype objects were also
  1374. added.
  1375. One potential caveat involving this change: format descriptor strings
  1376. should now be accessed via ``format_descriptor::format()`` (however, for
  1377. compatibility purposes, the old syntax ``format_descriptor::value`` will
  1378. still work for non-structured data types). `#308
  1379. <https://github.com/pybind/pybind11/pull/308>`_.
  1380. 4. Further improvements to support structured dtypes throughout the system.
  1381. `#472 <https://github.com/pybind/pybind11/pull/472>`_,
  1382. `#474 <https://github.com/pybind/pybind11/pull/474>`_,
  1383. `#459 <https://github.com/pybind/pybind11/pull/459>`_,
  1384. `#453 <https://github.com/pybind/pybind11/pull/453>`_,
  1385. `#452 <https://github.com/pybind/pybind11/pull/452>`_, and
  1386. `#505 <https://github.com/pybind/pybind11/pull/505>`_.
  1387. 5. Fast access operators. `#497 <https://github.com/pybind/pybind11/pull/497>`_.
  1388. 6. Constructors for arrays whose storage is owned by another object.
  1389. `#440 <https://github.com/pybind/pybind11/pull/440>`_.
  1390. 7. Added constructors for ``array`` and ``array_t`` explicitly accepting shape
  1391. and strides; if strides are not provided, they are deduced assuming
  1392. C-contiguity. Also added simplified constructors for 1-dimensional case.
  1393. 8. Added buffer/NumPy support for ``char[N]`` and ``std::array<char, N>`` types.
  1394. 9. Added ``memoryview`` wrapper type which is constructible from ``buffer_info``.
  1395. * Eigen: many additional conversions and support for non-contiguous
  1396. arrays/slices.
  1397. `#427 <https://github.com/pybind/pybind11/pull/427>`_,
  1398. `#315 <https://github.com/pybind/pybind11/pull/315>`_,
  1399. `#316 <https://github.com/pybind/pybind11/pull/316>`_,
  1400. `#312 <https://github.com/pybind/pybind11/pull/312>`_, and
  1401. `#267 <https://github.com/pybind/pybind11/pull/267>`_
  1402. * Incompatible changes in ``class_<...>::class_()``:
  1403. 1. Declarations of types that provide access via the buffer protocol must
  1404. now include the ``py::buffer_protocol()`` annotation as an argument to
  1405. the ``class_`` constructor.
  1406. 2. Declarations of types that require a custom metaclass (i.e. all classes
  1407. which include static properties via commands such as
  1408. ``def_readwrite_static()``) must now include the ``py::metaclass()``
  1409. annotation as an argument to the ``class_`` constructor.
  1410. These two changes were necessary to make type definitions in pybind11
  1411. future-proof, and to support PyPy via its cpyext mechanism. `#527
  1412. <https://github.com/pybind/pybind11/pull/527>`_.
  1413. 3. This version of pybind11 uses a redesigned mechanism for instantiating
  1414. trampoline classes that are used to override virtual methods from within
  1415. Python. This led to the following user-visible syntax change: instead of
  1416. .. code-block:: cpp
  1417. py::class_<TrampolineClass>("MyClass")
  1418. .alias<MyClass>()
  1419. ....
  1420. write
  1421. .. code-block:: cpp
  1422. py::class_<MyClass, TrampolineClass>("MyClass")
  1423. ....
  1424. Importantly, both the original and the trampoline class are now
  1425. specified as an arguments (in arbitrary order) to the ``py::class_``
  1426. template, and the ``alias<..>()`` call is gone. The new scheme has zero
  1427. overhead in cases when Python doesn't override any functions of the
  1428. underlying C++ class. `rev. 86d825
  1429. <https://github.com/pybind/pybind11/commit/86d825>`_.
  1430. * Added ``eval`` and ``eval_file`` functions for evaluating expressions and
  1431. statements from a string or file. `rev. 0d3fc3
  1432. <https://github.com/pybind/pybind11/commit/0d3fc3>`_.
  1433. * pybind11 can now create types with a modifiable dictionary.
  1434. `#437 <https://github.com/pybind/pybind11/pull/437>`_ and
  1435. `#444 <https://github.com/pybind/pybind11/pull/444>`_.
  1436. * Support for translation of arbitrary C++ exceptions to Python counterparts.
  1437. `#296 <https://github.com/pybind/pybind11/pull/296>`_ and
  1438. `#273 <https://github.com/pybind/pybind11/pull/273>`_.
  1439. * Report full backtraces through mixed C++/Python code, better reporting for
  1440. import errors, fixed GIL management in exception processing.
  1441. `#537 <https://github.com/pybind/pybind11/pull/537>`_,
  1442. `#494 <https://github.com/pybind/pybind11/pull/494>`_,
  1443. `rev. e72d95 <https://github.com/pybind/pybind11/commit/e72d95>`_, and
  1444. `rev. 099d6e <https://github.com/pybind/pybind11/commit/099d6e>`_.
  1445. * Support for bit-level operations, comparisons, and serialization of C++
  1446. enumerations. `#503 <https://github.com/pybind/pybind11/pull/503>`_,
  1447. `#508 <https://github.com/pybind/pybind11/pull/508>`_,
  1448. `#380 <https://github.com/pybind/pybind11/pull/380>`_,
  1449. `#309 <https://github.com/pybind/pybind11/pull/309>`_.
  1450. `#311 <https://github.com/pybind/pybind11/pull/311>`_.
  1451. * The ``class_`` constructor now accepts its template arguments in any order.
  1452. `#385 <https://github.com/pybind/pybind11/pull/385>`_.
  1453. * Attribute and item accessors now have a more complete interface which makes
  1454. it possible to chain attributes as in
  1455. ``obj.attr("a")[key].attr("b").attr("method")(1, 2, 3)``. `#425
  1456. <https://github.com/pybind/pybind11/pull/425>`_.
  1457. * Major redesign of the default and conversion constructors in ``pytypes.h``.
  1458. `#464 <https://github.com/pybind/pybind11/pull/464>`_.
  1459. * Added built-in support for ``std::shared_ptr`` holder type. It is no longer
  1460. necessary to to include a declaration of the form
  1461. ``PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>)`` (though continuing to
  1462. do so won't cause an error).
  1463. `#454 <https://github.com/pybind/pybind11/pull/454>`_.
  1464. * New ``py::overload_cast`` casting operator to select among multiple possible
  1465. overloads of a function. An example:
  1466. .. code-block:: cpp
  1467. py::class_<Pet>(m, "Pet")
  1468. .def("set", py::overload_cast<int>(&Pet::set), "Set the pet's age")
  1469. .def("set", py::overload_cast<const std::string &>(&Pet::set), "Set the pet's name");
  1470. This feature only works on C++14-capable compilers.
  1471. `#541 <https://github.com/pybind/pybind11/pull/541>`_.
  1472. * C++ types are automatically cast to Python types, e.g. when assigning
  1473. them as an attribute. For instance, the following is now legal:
  1474. .. code-block:: cpp
  1475. py::module m = /* ... */
  1476. m.attr("constant") = 123;
  1477. (Previously, a ``py::cast`` call was necessary to avoid a compilation error.)
  1478. `#551 <https://github.com/pybind/pybind11/pull/551>`_.
  1479. * Redesigned ``pytest``-based test suite. `#321 <https://github.com/pybind/pybind11/pull/321>`_.
  1480. * Instance tracking to detect reference leaks in test suite. `#324 <https://github.com/pybind/pybind11/pull/324>`_
  1481. * pybind11 can now distinguish between multiple different instances that are
  1482. located at the same memory address, but which have different types.
  1483. `#329 <https://github.com/pybind/pybind11/pull/329>`_.
  1484. * Improved logic in ``move`` return value policy.
  1485. `#510 <https://github.com/pybind/pybind11/pull/510>`_,
  1486. `#297 <https://github.com/pybind/pybind11/pull/297>`_.
  1487. * Generalized unpacking API to permit calling Python functions from C++ using
  1488. notation such as ``foo(a1, a2, *args, "ka"_a=1, "kb"_a=2, **kwargs)``. `#372 <https://github.com/pybind/pybind11/pull/372>`_.
  1489. * ``py::print()`` function whose behavior matches that of the native Python
  1490. ``print()`` function. `#372 <https://github.com/pybind/pybind11/pull/372>`_.
  1491. * Added ``py::dict`` keyword constructor:``auto d = dict("number"_a=42,
  1492. "name"_a="World");``. `#372 <https://github.com/pybind/pybind11/pull/372>`_.
  1493. * Added ``py::str::format()`` method and ``_s`` literal: ``py::str s = "1 + 2
  1494. = {}"_s.format(3);``. `#372 <https://github.com/pybind/pybind11/pull/372>`_.
  1495. * Added ``py::repr()`` function which is equivalent to Python's builtin
  1496. ``repr()``. `#333 <https://github.com/pybind/pybind11/pull/333>`_.
  1497. * Improved construction and destruction logic for holder types. It is now
  1498. possible to reference instances with smart pointer holder types without
  1499. constructing the holder if desired. The ``PYBIND11_DECLARE_HOLDER_TYPE``
  1500. macro now accepts an optional second parameter to indicate whether the holder
  1501. type uses intrusive reference counting.
  1502. `#533 <https://github.com/pybind/pybind11/pull/533>`_ and
  1503. `#561 <https://github.com/pybind/pybind11/pull/561>`_.
  1504. * Mapping a stateless C++ function to Python and back is now "for free" (i.e.
  1505. no extra indirections or argument conversion overheads). `rev. 954b79
  1506. <https://github.com/pybind/pybind11/commit/954b79>`_.
  1507. * Bindings for ``std::valarray<T>``.
  1508. `#545 <https://github.com/pybind/pybind11/pull/545>`_.
  1509. * Improved support for C++17 capable compilers.
  1510. `#562 <https://github.com/pybind/pybind11/pull/562>`_.
  1511. * Bindings for ``std::optional<t>``.
  1512. `#475 <https://github.com/pybind/pybind11/pull/475>`_,
  1513. `#476 <https://github.com/pybind/pybind11/pull/476>`_,
  1514. `#479 <https://github.com/pybind/pybind11/pull/479>`_,
  1515. `#499 <https://github.com/pybind/pybind11/pull/499>`_, and
  1516. `#501 <https://github.com/pybind/pybind11/pull/501>`_.
  1517. * ``stl_bind.h``: general improvements and support for ``std::map`` and
  1518. ``std::unordered_map``.
  1519. `#490 <https://github.com/pybind/pybind11/pull/490>`_,
  1520. `#282 <https://github.com/pybind/pybind11/pull/282>`_,
  1521. `#235 <https://github.com/pybind/pybind11/pull/235>`_.
  1522. * The ``std::tuple``, ``std::pair``, ``std::list``, and ``std::vector`` type
  1523. casters now accept any Python sequence type as input. `rev. 107285
  1524. <https://github.com/pybind/pybind11/commit/107285>`_.
  1525. * Improved CMake Python detection on multi-architecture Linux.
  1526. `#532 <https://github.com/pybind/pybind11/pull/532>`_.
  1527. * Infrastructure to selectively disable or enable parts of the automatically
  1528. generated docstrings. `#486 <https://github.com/pybind/pybind11/pull/486>`_.
  1529. * ``reference`` and ``reference_internal`` are now the default return value
  1530. properties for static and non-static properties, respectively. `#473
  1531. <https://github.com/pybind/pybind11/pull/473>`_. (the previous defaults
  1532. were ``automatic``). `#473 <https://github.com/pybind/pybind11/pull/473>`_.
  1533. * Support for ``std::unique_ptr`` with non-default deleters or no deleter at
  1534. all (``py::nodelete``). `#384 <https://github.com/pybind/pybind11/pull/384>`_.
  1535. * Deprecated ``handle::call()`` method. The new syntax to call Python
  1536. functions is simply ``handle()``. It can also be invoked explicitly via
  1537. ``handle::operator<X>()``, where ``X`` is an optional return value policy.
  1538. * Print more informative error messages when ``make_tuple()`` or ``cast()``
  1539. fail. `#262 <https://github.com/pybind/pybind11/pull/262>`_.
  1540. * Creation of holder types for classes deriving from
  1541. ``std::enable_shared_from_this<>`` now also works for ``const`` values.
  1542. `#260 <https://github.com/pybind/pybind11/pull/260>`_.
  1543. * ``make_iterator()`` improvements for better compatibility with various
  1544. types (now uses prefix increment operator); it now also accepts iterators
  1545. with different begin/end types as long as they are equality comparable.
  1546. `#247 <https://github.com/pybind/pybind11/pull/247>`_.
  1547. * ``arg()`` now accepts a wider range of argument types for default values.
  1548. `#244 <https://github.com/pybind/pybind11/pull/244>`_.
  1549. * Support ``keep_alive`` where the nurse object may be ``None``. `#341
  1550. <https://github.com/pybind/pybind11/pull/341>`_.
  1551. * Added constructors for ``str`` and ``bytes`` from zero-terminated char
  1552. pointers, and from char pointers and length. Added constructors for ``str``
  1553. from ``bytes`` and for ``bytes`` from ``str``, which will perform UTF-8
  1554. decoding/encoding as required.
  1555. * Many other improvements of library internals without user-visible changes
  1556. 1.8.1 (July 12, 2016)
  1557. ----------------------
  1558. * Fixed a rare but potentially very severe issue when the garbage collector ran
  1559. during pybind11 type creation.
  1560. 1.8.0 (June 14, 2016)
  1561. ----------------------
  1562. * Redesigned CMake build system which exports a convenient
  1563. ``pybind11_add_module`` function to parent projects.
  1564. * ``std::vector<>`` type bindings analogous to Boost.Python's ``indexing_suite``
  1565. * Transparent conversion of sparse and dense Eigen matrices and vectors (``eigen.h``)
  1566. * Added an ``ExtraFlags`` template argument to the NumPy ``array_t<>`` wrapper
  1567. to disable an enforced cast that may lose precision, e.g. to create overloads
  1568. for different precisions and complex vs real-valued matrices.
  1569. * Prevent implicit conversion of floating point values to integral types in
  1570. function arguments
  1571. * Fixed incorrect default return value policy for functions returning a shared
  1572. pointer
  1573. * Don't allow registering a type via ``class_`` twice
  1574. * Don't allow casting a ``None`` value into a C++ lvalue reference
  1575. * Fixed a crash in ``enum_::operator==`` that was triggered by the ``help()`` command
  1576. * Improved detection of whether or not custom C++ types can be copy/move-constructed
  1577. * Extended ``str`` type to also work with ``bytes`` instances
  1578. * Added a ``"name"_a`` user defined string literal that is equivalent to ``py::arg("name")``.
  1579. * When specifying function arguments via ``py::arg``, the test that verifies
  1580. the number of arguments now runs at compile time.
  1581. * Added ``[[noreturn]]`` attribute to ``pybind11_fail()`` to quench some
  1582. compiler warnings
  1583. * List function arguments in exception text when the dispatch code cannot find
  1584. a matching overload
  1585. * Added ``PYBIND11_OVERLOAD_NAME`` and ``PYBIND11_OVERLOAD_PURE_NAME`` macros which
  1586. can be used to override virtual methods whose name differs in C++ and Python
  1587. (e.g. ``__call__`` and ``operator()``)
  1588. * Various minor ``iterator`` and ``make_iterator()`` improvements
  1589. * Transparently support ``__bool__`` on Python 2.x and Python 3.x
  1590. * Fixed issue with destructor of unpickled object not being called
  1591. * Minor CMake build system improvements on Windows
  1592. * New ``pybind11::args`` and ``pybind11::kwargs`` types to create functions which
  1593. take an arbitrary number of arguments and keyword arguments
  1594. * New syntax to call a Python function from C++ using ``*args`` and ``*kwargs``
  1595. * The functions ``def_property_*`` now correctly process docstring arguments (these
  1596. formerly caused a segmentation fault)
  1597. * Many ``mkdoc.py`` improvements (enumerations, template arguments, ``DOC()``
  1598. macro accepts more arguments)
  1599. * Cygwin support
  1600. * Documentation improvements (pickling support, ``keep_alive``, macro usage)
  1601. 1.7 (April 30, 2016)
  1602. ----------------------
  1603. * Added a new ``move`` return value policy that triggers C++11 move semantics.
  1604. The automatic return value policy falls back to this case whenever a rvalue
  1605. reference is encountered
  1606. * Significantly more general GIL state routines that are used instead of
  1607. Python's troublesome ``PyGILState_Ensure`` and ``PyGILState_Release`` API
  1608. * Redesign of opaque types that drastically simplifies their usage
  1609. * Extended ability to pass values of type ``[const] void *``
  1610. * ``keep_alive`` fix: don't fail when there is no patient
  1611. * ``functional.h``: acquire the GIL before calling a Python function
  1612. * Added Python RAII type wrappers ``none`` and ``iterable``
  1613. * Added ``*args`` and ``*kwargs`` pass-through parameters to
  1614. ``pybind11.get_include()`` function
  1615. * Iterator improvements and fixes
  1616. * Documentation on return value policies and opaque types improved
  1617. 1.6 (April 30, 2016)
  1618. ----------------------
  1619. * Skipped due to upload to PyPI gone wrong and inability to recover
  1620. (https://github.com/pypa/packaging-problems/issues/74)
  1621. 1.5 (April 21, 2016)
  1622. ----------------------
  1623. * For polymorphic types, use RTTI to try to return the closest type registered with pybind11
  1624. * Pickling support for serializing and unserializing C++ instances to a byte stream in Python
  1625. * Added a convenience routine ``make_iterator()`` which turns a range indicated
  1626. by a pair of C++ iterators into a iterable Python object
  1627. * Added ``len()`` and a variadic ``make_tuple()`` function
  1628. * Addressed a rare issue that could confuse the current virtual function
  1629. dispatcher and another that could lead to crashes in multi-threaded
  1630. applications
  1631. * Added a ``get_include()`` function to the Python module that returns the path
  1632. of the directory containing the installed pybind11 header files
  1633. * Documentation improvements: import issues, symbol visibility, pickling, limitations
  1634. * Added casting support for ``std::reference_wrapper<>``
  1635. 1.4 (April 7, 2016)
  1636. --------------------------
  1637. * Transparent type conversion for ``std::wstring`` and ``wchar_t``
  1638. * Allow passing ``nullptr``-valued strings
  1639. * Transparent passing of ``void *`` pointers using capsules
  1640. * Transparent support for returning values wrapped in ``std::unique_ptr<>``
  1641. * Improved docstring generation for compatibility with Sphinx
  1642. * Nicer debug error message when default parameter construction fails
  1643. * Support for "opaque" types that bypass the transparent conversion layer for STL containers
  1644. * Redesigned type casting interface to avoid ambiguities that could occasionally cause compiler errors
  1645. * Redesigned property implementation; fixes crashes due to an unfortunate default return value policy
  1646. * Anaconda package generation support
  1647. 1.3 (March 8, 2016)
  1648. --------------------------
  1649. * Added support for the Intel C++ compiler (v15+)
  1650. * Added support for the STL unordered set/map data structures
  1651. * Added support for the STL linked list data structure
  1652. * NumPy-style broadcasting support in ``pybind11::vectorize``
  1653. * pybind11 now displays more verbose error messages when ``arg::operator=()`` fails
  1654. * pybind11 internal data structures now live in a version-dependent namespace to avoid ABI issues
  1655. * Many, many bugfixes involving corner cases and advanced usage
  1656. 1.2 (February 7, 2016)
  1657. --------------------------
  1658. * Optional: efficient generation of function signatures at compile time using C++14
  1659. * Switched to a simpler and more general way of dealing with function default
  1660. arguments. Unused keyword arguments in function calls are now detected and
  1661. cause errors as expected
  1662. * New ``keep_alive`` call policy analogous to Boost.Python's ``with_custodian_and_ward``
  1663. * New ``pybind11::base<>`` attribute to indicate a subclass relationship
  1664. * Improved interface for RAII type wrappers in ``pytypes.h``
  1665. * Use RAII type wrappers consistently within pybind11 itself. This
  1666. fixes various potential refcount leaks when exceptions occur
  1667. * Added new ``bytes`` RAII type wrapper (maps to ``string`` in Python 2.7)
  1668. * Made handle and related RAII classes const correct, using them more
  1669. consistently everywhere now
  1670. * Got rid of the ugly ``__pybind11__`` attributes on the Python side---they are
  1671. now stored in a C++ hash table that is not visible in Python
  1672. * Fixed refcount leaks involving NumPy arrays and bound functions
  1673. * Vastly improved handling of shared/smart pointers
  1674. * Removed an unnecessary copy operation in ``pybind11::vectorize``
  1675. * Fixed naming clashes when both pybind11 and NumPy headers are included
  1676. * Added conversions for additional exception types
  1677. * Documentation improvements (using multiple extension modules, smart pointers,
  1678. other minor clarifications)
  1679. * unified infrastructure for parsing variadic arguments in ``class_`` and cpp_function
  1680. * Fixed license text (was: ZLIB, should have been: 3-clause BSD)
  1681. * Python 3.2 compatibility
  1682. * Fixed remaining issues when accessing types in another plugin module
  1683. * Added enum comparison and casting methods
  1684. * Improved SFINAE-based detection of whether types are copy-constructible
  1685. * Eliminated many warnings about unused variables and the use of ``offsetof()``
  1686. * Support for ``std::array<>`` conversions
  1687. 1.1 (December 7, 2015)
  1688. --------------------------
  1689. * Documentation improvements (GIL, wrapping functions, casting, fixed many typos)
  1690. * Generalized conversion of integer types
  1691. * Improved support for casting function objects
  1692. * Improved support for ``std::shared_ptr<>`` conversions
  1693. * Initial support for ``std::set<>`` conversions
  1694. * Fixed type resolution issue for types defined in a separate plugin module
  1695. * CMake build system improvements
  1696. * Factored out generic functionality to non-templated code (smaller code size)
  1697. * Added a code size / compile time benchmark vs Boost.Python
  1698. * Added an appveyor CI script
  1699. 1.0 (October 15, 2015)
  1700. ------------------------
  1701. * Initial release