changelog.rst 72 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679
  1. .. _changelog:
  2. Changelog
  3. #########
  4. Starting with version 1.8.0, pybind11 releases use a `semantic versioning
  5. <http://semver.org>`_ policy.
  6. v2.7.0 (TBA, not yet released)
  7. ------------------------------
  8. * ``py::str`` changed to exclusively hold `PyUnicodeObject`. Previously
  9. ``py::str`` could also hold `bytes`, which is probably surprising, was
  10. never documented, and can mask bugs (e.g. accidental use of ``py::str``
  11. instead of ``py::bytes``).
  12. `#2409 <https://github.com/pybind/pybind11/pull/2409>`_
  13. v2.6.2 (Jan 26, 2021)
  14. ---------------------
  15. Minor missing functionality added:
  16. * enum: add missing Enum.value property.
  17. `#2739 <https://github.com/pybind/pybind11/pull/2739>`_
  18. * Allow thread termination to be avoided during shutdown for CPython 3.7+ via
  19. ``.disarm`` for ``gil_scoped_acquire``/``gil_scoped_release``.
  20. `#2657 <https://github.com/pybind/pybind11/pull/2657>`_
  21. Fixed or improved behavior in a few special cases:
  22. * Fix bug where the constructor of ``object`` subclasses would not throw on
  23. being passed a Python object of the wrong type.
  24. `#2701 <https://github.com/pybind/pybind11/pull/2701>`_
  25. * The ``type_caster`` for integers does not convert Python objects with
  26. ``__int__`` anymore with ``noconvert`` or during the first round of trying
  27. overloads.
  28. `#2698 <https://github.com/pybind/pybind11/pull/2698>`_
  29. * When casting to a C++ integer, ``__index__`` is always called and not
  30. considered as conversion, consistent with Python 3.8+.
  31. `#2801 <https://github.com/pybind/pybind11/pull/2801>`_
  32. Build improvements:
  33. * Setup helpers: ``extra_compile_args`` and ``extra_link_args`` automatically set by
  34. Pybind11Extension are now prepended, which allows them to be overridden
  35. by user-set ``extra_compile_args`` and ``extra_link_args``.
  36. `#2808 <https://github.com/pybind/pybind11/pull/2808>`_
  37. * Setup helpers: Don't trigger unused parameter warning.
  38. `#2735 <https://github.com/pybind/pybind11/pull/2735>`_
  39. * CMake: Support running with ``--warn-uninitialized`` active.
  40. `#2806 <https://github.com/pybind/pybind11/pull/2806>`_
  41. * CMake: Avoid error if included from two submodule directories.
  42. `#2804 <https://github.com/pybind/pybind11/pull/2804>`_
  43. * CMake: Fix ``STATIC`` / ``SHARED`` being ignored in FindPython mode.
  44. `#2796 <https://github.com/pybind/pybind11/pull/2796>`_
  45. * CMake: Respect the setting for ``CMAKE_CXX_VISIBILITY_PRESET`` if defined.
  46. `#2793 <https://github.com/pybind/pybind11/pull/2793>`_
  47. * CMake: Fix issue with FindPython2/FindPython3 not working with ``pybind11::embed``.
  48. `#2662 <https://github.com/pybind/pybind11/pull/2662>`_
  49. * CMake: mixing local and installed pybind11's would prioritize the installed
  50. one over the local one (regression in 2.6.0).
  51. `#2716 <https://github.com/pybind/pybind11/pull/2716>`_
  52. Bug fixes:
  53. * Fixed segfault in multithreaded environments when using
  54. ``scoped_ostream_redirect``.
  55. `#2675 <https://github.com/pybind/pybind11/pull/2675>`_
  56. * Leave docstring unset when all docstring-related options are disabled, rather
  57. than set an empty string.
  58. `#2745 <https://github.com/pybind/pybind11/pull/2745>`_
  59. * The module key in builtins that pybind11 uses to store its internals changed
  60. from std::string to a python str type (more natural on Python 2, no change on
  61. Python 3).
  62. `#2814 <https://github.com/pybind/pybind11/pull/2814>`_
  63. * Fixed assertion error related to unhandled (later overwritten) exception in
  64. CPython 3.8 and 3.9 debug builds.
  65. `#2685 <https://github.com/pybind/pybind11/pull/2685>`_
  66. * Fix ``py::gil_scoped_acquire`` assert with CPython 3.9 debug build.
  67. `#2683 <https://github.com/pybind/pybind11/pull/2683>`_
  68. * Fix issue with a test failing on PyTest 6.2.
  69. `#2741 <https://github.com/pybind/pybind11/pull/2741>`_
  70. Warning fixes:
  71. * Fix warning modifying constructor parameter 'flag' that shadows a field of
  72. 'set_flag' ``[-Wshadow-field-in-constructor-modified]``.
  73. `#2780 <https://github.com/pybind/pybind11/pull/2780>`_
  74. * Suppressed some deprecation warnings about old-style
  75. ``__init__``/``__setstate__`` in the tests.
  76. `#2759 <https://github.com/pybind/pybind11/pull/2759>`_
  77. Valgrind work:
  78. * Fix invalid access when calling a pybind11 ``__init__`` on a non-pybind11
  79. class instance.
  80. `#2755 <https://github.com/pybind/pybind11/pull/2755>`_
  81. * Fixed various minor memory leaks in pybind11's test suite.
  82. `#2758 <https://github.com/pybind/pybind11/pull/2758>`_
  83. * Resolved memory leak in cpp_function initialization when exceptions occurred.
  84. `#2756 <https://github.com/pybind/pybind11/pull/2756>`_
  85. * Added a Valgrind build, checking for leaks and memory-related UB, to CI.
  86. `#2746 <https://github.com/pybind/pybind11/pull/2746>`_
  87. Compiler support:
  88. * Intel compiler was not activating C++14 support due to a broken define.
  89. `#2679 <https://github.com/pybind/pybind11/pull/2679>`_
  90. * Support ICC and NVIDIA HPC SDK in C++17 mode.
  91. `#2729 <https://github.com/pybind/pybind11/pull/2729>`_
  92. * Support Intel OneAPI compiler (ICC 20.2) and add to CI.
  93. `#2573 <https://github.com/pybind/pybind11/pull/2573>`_
  94. v2.6.1 (Nov 11, 2020)
  95. ---------------------
  96. * ``py::exec``, ``py::eval``, and ``py::eval_file`` now add the builtins module
  97. as ``"__builtins__"`` to their ``globals`` argument, better matching ``exec``
  98. and ``eval`` in pure Python.
  99. `#2616 <https://github.com/pybind/pybind11/pull/2616>`_
  100. * ``setup_helpers`` will no longer set a minimum macOS version higher than the
  101. current version.
  102. `#2622 <https://github.com/pybind/pybind11/pull/2622>`_
  103. * Allow deleting static properties.
  104. `#2629 <https://github.com/pybind/pybind11/pull/2629>`_
  105. * Seal a leak in ``def_buffer``, cleaning up the ``capture`` object after the
  106. ``class_`` object goes out of scope.
  107. `#2634 <https://github.com/pybind/pybind11/pull/2634>`_
  108. * ``pybind11_INCLUDE_DIRS`` was incorrect, potentially causing a regression if
  109. it was expected to include ``PYTHON_INCLUDE_DIRS`` (please use targets
  110. instead).
  111. `#2636 <https://github.com/pybind/pybind11/pull/2636>`_
  112. * Added parameter names to the ``py::enum_`` constructor and methods, avoiding
  113. ``arg0`` in the generated docstrings.
  114. `#2637 <https://github.com/pybind/pybind11/pull/2637>`_
  115. * Added ``needs_recompile`` optional function to the ``ParallelCompiler``
  116. helper, to allow a recompile to be skipped based on a user-defined function.
  117. `#2643 <https://github.com/pybind/pybind11/pull/2643>`_
  118. v2.6.0 (Oct 21, 2020)
  119. ---------------------
  120. See :ref:`upgrade-guide-2.6` for help upgrading to the new version.
  121. New features:
  122. * Keyword-only arguments supported in Python 2 or 3 with ``py::kw_only()``.
  123. `#2100 <https://github.com/pybind/pybind11/pull/2100>`_
  124. * Positional-only arguments supported in Python 2 or 3 with ``py::pos_only()``.
  125. `#2459 <https://github.com/pybind/pybind11/pull/2459>`_
  126. * ``py::is_final()`` class modifier to block subclassing (CPython only).
  127. `#2151 <https://github.com/pybind/pybind11/pull/2151>`_
  128. * Added ``py::prepend()``, allowing a function to be placed at the beginning of
  129. the overload chain.
  130. `#1131 <https://github.com/pybind/pybind11/pull/1131>`_
  131. * Access to the type object now provided with ``py::type::of<T>()`` and
  132. ``py::type::of(h)``.
  133. `#2364 <https://github.com/pybind/pybind11/pull/2364>`_
  134. * Perfect forwarding support for methods.
  135. `#2048 <https://github.com/pybind/pybind11/pull/2048>`_
  136. * Added ``py::error_already_set::discard_as_unraisable()``.
  137. `#2372 <https://github.com/pybind/pybind11/pull/2372>`_
  138. * ``py::hash`` is now public.
  139. `#2217 <https://github.com/pybind/pybind11/pull/2217>`_
  140. * ``py::class_<union_type>`` is now supported. Note that writing to one data
  141. member of the union and reading another (type punning) is UB in C++. Thus
  142. pybind11-bound enums should never be used for such conversions.
  143. `#2320 <https://github.com/pybind/pybind11/pull/2320>`_.
  144. * Classes now check local scope when registering members, allowing a subclass
  145. to have a member with the same name as a parent (such as an enum).
  146. `#2335 <https://github.com/pybind/pybind11/pull/2335>`_
  147. Code correctness features:
  148. * Error now thrown when ``__init__`` is forgotten on subclasses.
  149. `#2152 <https://github.com/pybind/pybind11/pull/2152>`_
  150. * Throw error if conversion to a pybind11 type if the Python object isn't a
  151. valid instance of that type, such as ``py::bytes(o)`` when ``py::object o``
  152. isn't a bytes instance.
  153. `#2349 <https://github.com/pybind/pybind11/pull/2349>`_
  154. * Throw if conversion to ``str`` fails.
  155. `#2477 <https://github.com/pybind/pybind11/pull/2477>`_
  156. API changes:
  157. * ``py::module`` was renamed ``py::module_`` to avoid issues with C++20 when
  158. used unqualified, but an alias ``py::module`` is provided for backward
  159. compatibility.
  160. `#2489 <https://github.com/pybind/pybind11/pull/2489>`_
  161. * Public constructors for ``py::module_`` have been deprecated; please use
  162. ``pybind11::module_::create_extension_module`` if you were using the public
  163. constructor (fairly rare after ``PYBIND11_MODULE`` was introduced).
  164. `#2552 <https://github.com/pybind/pybind11/pull/2552>`_
  165. * ``PYBIND11_OVERLOAD*`` macros and ``get_overload`` function replaced by
  166. correctly-named ``PYBIND11_OVERRIDE*`` and ``get_override``, fixing
  167. inconsistencies in the presence of a closing ``;`` in these macros.
  168. ``get_type_overload`` is deprecated.
  169. `#2325 <https://github.com/pybind/pybind11/pull/2325>`_
  170. Packaging / building improvements:
  171. * The Python package was reworked to be more powerful and useful.
  172. `#2433 <https://github.com/pybind/pybind11/pull/2433>`_
  173. * :ref:`build-setuptools` is easier thanks to a new
  174. ``pybind11.setup_helpers`` module, which provides utilities to use
  175. setuptools with pybind11. It can be used via PEP 518, ``setup_requires``,
  176. or by directly importing or copying ``setup_helpers.py`` into your project.
  177. * CMake configuration files are now included in the Python package. Use
  178. ``pybind11.get_cmake_dir()`` or ``python -m pybind11 --cmakedir`` to get
  179. the directory with the CMake configuration files, or include the
  180. site-packages location in your ``CMAKE_MODULE_PATH``. Or you can use the
  181. new ``pybind11[global]`` extra when you install ``pybind11``, which
  182. installs the CMake files and headers into your base environment in the
  183. standard location.
  184. * ``pybind11-config`` is another way to write ``python -m pybind11`` if you
  185. have your PATH set up.
  186. * Added external typing support to the helper module, code from
  187. ``import pybind11`` can now be type checked.
  188. `#2588 <https://github.com/pybind/pybind11/pull/2588>`_
  189. * Minimum CMake required increased to 3.4.
  190. `#2338 <https://github.com/pybind/pybind11/pull/2338>`_ and
  191. `#2370 <https://github.com/pybind/pybind11/pull/2370>`_
  192. * Full integration with CMake’s C++ standard system and compile features
  193. replaces ``PYBIND11_CPP_STANDARD``.
  194. * Generated config file is now portable to different Python/compiler/CMake
  195. versions.
  196. * Virtual environments prioritized if ``PYTHON_EXECUTABLE`` is not set
  197. (``venv``, ``virtualenv``, and ``conda``) (similar to the new FindPython
  198. mode).
  199. * Other CMake features now natively supported, like
  200. ``CMAKE_INTERPROCEDURAL_OPTIMIZATION``, ``set(CMAKE_CXX_VISIBILITY_PRESET
  201. hidden)``.
  202. * ``CUDA`` as a language is now supported.
  203. * Helper functions ``pybind11_strip``, ``pybind11_extension``,
  204. ``pybind11_find_import`` added, see :doc:`cmake/index`.
  205. * Optional :ref:`find-python-mode` and :ref:`nopython-mode` with CMake.
  206. `#2370 <https://github.com/pybind/pybind11/pull/2370>`_
  207. * Uninstall target added.
  208. `#2265 <https://github.com/pybind/pybind11/pull/2265>`_ and
  209. `#2346 <https://github.com/pybind/pybind11/pull/2346>`_
  210. * ``pybind11_add_module()`` now accepts an optional ``OPT_SIZE`` flag that
  211. switches the binding target to size-based optimization if the global build
  212. type can not always be fixed to ``MinSizeRel`` (except in debug mode, where
  213. optimizations remain disabled). ``MinSizeRel`` or this flag reduces binary
  214. size quite substantially (~25% on some platforms).
  215. `#2463 <https://github.com/pybind/pybind11/pull/2463>`_
  216. Smaller or developer focused features and fixes:
  217. * Moved ``mkdoc.py`` to a new repo, `pybind11-mkdoc`_. There are no longer
  218. submodules in the main repo.
  219. * ``py::memoryview`` segfault fix and update, with new
  220. ``py::memoryview::from_memory`` in Python 3, and documentation.
  221. `#2223 <https://github.com/pybind/pybind11/pull/2223>`_
  222. * Fix for ``buffer_info`` on Python 2.
  223. `#2503 <https://github.com/pybind/pybind11/pull/2503>`_
  224. * If ``__eq__`` defined but not ``__hash__``, ``__hash__`` is now set to
  225. ``None``.
  226. `#2291 <https://github.com/pybind/pybind11/pull/2291>`_
  227. * ``py::ellipsis`` now also works on Python 2.
  228. `#2360 <https://github.com/pybind/pybind11/pull/2360>`_
  229. * Pointer to ``std::tuple`` & ``std::pair`` supported in cast.
  230. `#2334 <https://github.com/pybind/pybind11/pull/2334>`_
  231. * Small fixes in NumPy support. ``py::array`` now uses ``py::ssize_t`` as first
  232. argument type.
  233. `#2293 <https://github.com/pybind/pybind11/pull/2293>`_
  234. * Added missing signature for ``py::array``.
  235. `#2363 <https://github.com/pybind/pybind11/pull/2363>`_
  236. * ``unchecked_mutable_reference`` has access to operator ``()`` and ``[]`` when
  237. const.
  238. `#2514 <https://github.com/pybind/pybind11/pull/2514>`_
  239. * ``py::vectorize`` is now supported on functions that return void.
  240. `#1969 <https://github.com/pybind/pybind11/pull/1969>`_
  241. * ``py::capsule`` supports ``get_pointer`` and ``set_pointer``.
  242. `#1131 <https://github.com/pybind/pybind11/pull/1131>`_
  243. * Fix crash when different instances share the same pointer of the same type.
  244. `#2252 <https://github.com/pybind/pybind11/pull/2252>`_
  245. * Fix for ``py::len`` not clearing Python's error state when it fails and throws.
  246. `#2575 <https://github.com/pybind/pybind11/pull/2575>`_
  247. * Bugfixes related to more extensive testing, new GitHub Actions CI.
  248. `#2321 <https://github.com/pybind/pybind11/pull/2321>`_
  249. * Bug in timezone issue in Eastern hemisphere midnight fixed.
  250. `#2438 <https://github.com/pybind/pybind11/pull/2438>`_
  251. * ``std::chrono::time_point`` now works when the resolution is not the same as
  252. the system.
  253. `#2481 <https://github.com/pybind/pybind11/pull/2481>`_
  254. * Bug fixed where ``py::array_t`` could accept arrays that did not match the
  255. requested ordering.
  256. `#2484 <https://github.com/pybind/pybind11/pull/2484>`_
  257. * Avoid a segfault on some compilers when types are removed in Python.
  258. `#2564 <https://github.com/pybind/pybind11/pull/2564>`_
  259. * ``py::arg::none()`` is now also respected when passing keyword arguments.
  260. `#2611 <https://github.com/pybind/pybind11/pull/2611>`_
  261. * PyPy fixes, PyPy 7.3.x now supported, including PyPy3. (Known issue with
  262. PyPy2 and Windows `#2596 <https://github.com/pybind/pybind11/issues/2596>`_).
  263. `#2146 <https://github.com/pybind/pybind11/pull/2146>`_
  264. * CPython 3.9.0 workaround for undefined behavior (macOS segfault).
  265. `#2576 <https://github.com/pybind/pybind11/pull/2576>`_
  266. * CPython 3.9 warning fixes.
  267. `#2253 <https://github.com/pybind/pybind11/pull/2253>`_
  268. * Improved C++20 support, now tested in CI.
  269. `#2489 <https://github.com/pybind/pybind11/pull/2489>`_
  270. `#2599 <https://github.com/pybind/pybind11/pull/2599>`_
  271. * Improved but still incomplete debug Python interpreter support.
  272. `#2025 <https://github.com/pybind/pybind11/pull/2025>`_
  273. * NVCC (CUDA 11) now supported and tested in CI.
  274. `#2461 <https://github.com/pybind/pybind11/pull/2461>`_
  275. * NVIDIA PGI compilers now supported and tested in CI.
  276. `#2475 <https://github.com/pybind/pybind11/pull/2475>`_
  277. * At least Intel 18 now explicitly required when compiling with Intel.
  278. `#2577 <https://github.com/pybind/pybind11/pull/2577>`_
  279. * Extensive style checking in CI, with `pre-commit`_ support. Code
  280. modernization, checked by clang-tidy.
  281. * Expanded docs, including new main page, new installing section, and CMake
  282. helpers page, along with over a dozen new sections on existing pages.
  283. * In GitHub, new docs for contributing and new issue templates.
  284. .. _pre-commit: https://pre-commit.com
  285. .. _pybind11-mkdoc: https://github.com/pybind/pybind11-mkdoc
  286. v2.5.0 (Mar 31, 2020)
  287. -----------------------------------------------------
  288. * Use C++17 fold expressions in type casters, if available. This can
  289. improve performance during overload resolution when functions have
  290. multiple arguments.
  291. `#2043 <https://github.com/pybind/pybind11/pull/2043>`_.
  292. * Changed include directory resolution in ``pybind11/__init__.py``
  293. and installation in ``setup.py``. This fixes a number of open issues
  294. where pybind11 headers could not be found in certain environments.
  295. `#1995 <https://github.com/pybind/pybind11/pull/1995>`_.
  296. * C++20 ``char8_t`` and ``u8string`` support. `#2026
  297. <https://github.com/pybind/pybind11/pull/2026>`_.
  298. * CMake: search for Python 3.9. `bb9c91
  299. <https://github.com/pybind/pybind11/commit/bb9c91>`_.
  300. * Fixes for MSYS-based build environments.
  301. `#2087 <https://github.com/pybind/pybind11/pull/2087>`_,
  302. `#2053 <https://github.com/pybind/pybind11/pull/2053>`_.
  303. * STL bindings for ``std::vector<...>::clear``. `#2074
  304. <https://github.com/pybind/pybind11/pull/2074>`_.
  305. * Read-only flag for ``py::buffer``. `#1466
  306. <https://github.com/pybind/pybind11/pull/1466>`_.
  307. * Exception handling during module initialization.
  308. `bf2b031 <https://github.com/pybind/pybind11/commit/bf2b031>`_.
  309. * Support linking against a CPython debug build.
  310. `#2025 <https://github.com/pybind/pybind11/pull/2025>`_.
  311. * Fixed issues involving the availability and use of aligned ``new`` and
  312. ``delete``. `#1988 <https://github.com/pybind/pybind11/pull/1988>`_,
  313. `759221 <https://github.com/pybind/pybind11/commit/759221>`_.
  314. * Fixed a resource leak upon interpreter shutdown.
  315. `#2020 <https://github.com/pybind/pybind11/pull/2020>`_.
  316. * Fixed error handling in the boolean caster.
  317. `#1976 <https://github.com/pybind/pybind11/pull/1976>`_.
  318. v2.4.3 (Oct 15, 2019)
  319. -----------------------------------------------------
  320. * Adapt pybind11 to a C API convention change in Python 3.8. `#1950
  321. <https://github.com/pybind/pybind11/pull/1950>`_.
  322. v2.4.2 (Sep 21, 2019)
  323. -----------------------------------------------------
  324. * Replaced usage of a C++14 only construct. `#1929
  325. <https://github.com/pybind/pybind11/pull/1929>`_.
  326. * Made an ifdef future-proof for Python >= 4. `f3109d
  327. <https://github.com/pybind/pybind11/commit/f3109d>`_.
  328. v2.4.1 (Sep 20, 2019)
  329. -----------------------------------------------------
  330. * Fixed a problem involving implicit conversion from enumerations to integers
  331. on Python 3.8. `#1780 <https://github.com/pybind/pybind11/pull/1780>`_.
  332. v2.4.0 (Sep 19, 2019)
  333. -----------------------------------------------------
  334. * Try harder to keep pybind11-internal data structures separate when there
  335. are potential ABI incompatibilities. Fixes crashes that occurred when loading
  336. multiple pybind11 extensions that were e.g. compiled by GCC (libstdc++)
  337. and Clang (libc++).
  338. `#1588 <https://github.com/pybind/pybind11/pull/1588>`_ and
  339. `c9f5a <https://github.com/pybind/pybind11/commit/c9f5a>`_.
  340. * Added support for ``__await__``, ``__aiter__``, and ``__anext__`` protocols.
  341. `#1842 <https://github.com/pybind/pybind11/pull/1842>`_.
  342. * ``pybind11_add_module()``: don't strip symbols when compiling in
  343. ``RelWithDebInfo`` mode. `#1980
  344. <https://github.com/pybind/pybind11/pull/1980>`_.
  345. * ``enum_``: Reproduce Python behavior when comparing against invalid values
  346. (e.g. ``None``, strings, etc.). Add back support for ``__invert__()``.
  347. `#1912 <https://github.com/pybind/pybind11/pull/1912>`_,
  348. `#1907 <https://github.com/pybind/pybind11/pull/1907>`_.
  349. * List insertion operation for ``py::list``.
  350. Added ``.empty()`` to all collection types.
  351. Added ``py::set::contains()`` and ``py::dict::contains()``.
  352. `#1887 <https://github.com/pybind/pybind11/pull/1887>`_,
  353. `#1884 <https://github.com/pybind/pybind11/pull/1884>`_,
  354. `#1888 <https://github.com/pybind/pybind11/pull/1888>`_.
  355. * ``py::details::overload_cast_impl`` is available in C++11 mode, can be used
  356. like ``overload_cast`` with an additional set of parantheses.
  357. `#1581 <https://github.com/pybind/pybind11/pull/1581>`_.
  358. * Fixed ``get_include()`` on Conda.
  359. `#1877 <https://github.com/pybind/pybind11/pull/1877>`_.
  360. * ``stl_bind.h``: negative indexing support.
  361. `#1882 <https://github.com/pybind/pybind11/pull/1882>`_.
  362. * Minor CMake fix to add MinGW compatibility.
  363. `#1851 <https://github.com/pybind/pybind11/pull/1851>`_.
  364. * GIL-related fixes.
  365. `#1836 <https://github.com/pybind/pybind11/pull/1836>`_,
  366. `8b90b <https://github.com/pybind/pybind11/commit/8b90b>`_.
  367. * Other very minor/subtle fixes and improvements.
  368. `#1329 <https://github.com/pybind/pybind11/pull/1329>`_,
  369. `#1910 <https://github.com/pybind/pybind11/pull/1910>`_,
  370. `#1863 <https://github.com/pybind/pybind11/pull/1863>`_,
  371. `#1847 <https://github.com/pybind/pybind11/pull/1847>`_,
  372. `#1890 <https://github.com/pybind/pybind11/pull/1890>`_,
  373. `#1860 <https://github.com/pybind/pybind11/pull/1860>`_,
  374. `#1848 <https://github.com/pybind/pybind11/pull/1848>`_,
  375. `#1821 <https://github.com/pybind/pybind11/pull/1821>`_,
  376. `#1837 <https://github.com/pybind/pybind11/pull/1837>`_,
  377. `#1833 <https://github.com/pybind/pybind11/pull/1833>`_,
  378. `#1748 <https://github.com/pybind/pybind11/pull/1748>`_,
  379. `#1852 <https://github.com/pybind/pybind11/pull/1852>`_.
  380. v2.3.0 (June 11, 2019)
  381. -----------------------------------------------------
  382. * Significantly reduced module binary size (10-20%) when compiled in C++11 mode
  383. with GCC/Clang, or in any mode with MSVC. Function signatures are now always
  384. precomputed at compile time (this was previously only available in C++14 mode
  385. for non-MSVC compilers).
  386. `#934 <https://github.com/pybind/pybind11/pull/934>`_.
  387. * Add basic support for tag-based static polymorphism, where classes
  388. provide a method to returns the desired type of an instance.
  389. `#1326 <https://github.com/pybind/pybind11/pull/1326>`_.
  390. * Python type wrappers (``py::handle``, ``py::object``, etc.)
  391. now support map Python's number protocol onto C++ arithmetic
  392. operators such as ``operator+``, ``operator/=``, etc.
  393. `#1511 <https://github.com/pybind/pybind11/pull/1511>`_.
  394. * A number of improvements related to enumerations:
  395. 1. The ``enum_`` implementation was rewritten from scratch to reduce
  396. code bloat. Rather than instantiating a full implementation for each
  397. enumeration, most code is now contained in a generic base class.
  398. `#1511 <https://github.com/pybind/pybind11/pull/1511>`_.
  399. 2. The ``value()`` method of ``py::enum_`` now accepts an optional
  400. docstring that will be shown in the documentation of the associated
  401. enumeration. `#1160 <https://github.com/pybind/pybind11/pull/1160>`_.
  402. 3. check for already existing enum value and throw an error if present.
  403. `#1453 <https://github.com/pybind/pybind11/pull/1453>`_.
  404. * Support for over-aligned type allocation via C++17's aligned ``new``
  405. statement. `#1582 <https://github.com/pybind/pybind11/pull/1582>`_.
  406. * Added ``py::ellipsis()`` method for slicing of multidimensional NumPy arrays
  407. `#1502 <https://github.com/pybind/pybind11/pull/1502>`_.
  408. * Numerous Improvements to the ``mkdoc.py`` script for extracting documentation
  409. from C++ header files.
  410. `#1788 <https://github.com/pybind/pybind11/pull/1788>`_.
  411. * ``pybind11_add_module()``: allow including Python as a ``SYSTEM`` include path.
  412. `#1416 <https://github.com/pybind/pybind11/pull/1416>`_.
  413. * ``pybind11/stl.h`` does not convert strings to ``vector<string>`` anymore.
  414. `#1258 <https://github.com/pybind/pybind11/issues/1258>`_.
  415. * Mark static methods as such to fix auto-generated Sphinx documentation.
  416. `#1732 <https://github.com/pybind/pybind11/pull/1732>`_.
  417. * Re-throw forced unwind exceptions (e.g. during pthread termination).
  418. `#1208 <https://github.com/pybind/pybind11/pull/1208>`_.
  419. * Added ``__contains__`` method to the bindings of maps (``std::map``,
  420. ``std::unordered_map``).
  421. `#1767 <https://github.com/pybind/pybind11/pull/1767>`_.
  422. * Improvements to ``gil_scoped_acquire``.
  423. `#1211 <https://github.com/pybind/pybind11/pull/1211>`_.
  424. * Type caster support for ``std::deque<T>``.
  425. `#1609 <https://github.com/pybind/pybind11/pull/1609>`_.
  426. * Support for ``std::unique_ptr`` holders, whose deleters differ between a base and derived
  427. class. `#1353 <https://github.com/pybind/pybind11/pull/1353>`_.
  428. * Construction of STL array/vector-like data structures from
  429. iterators. Added an ``extend()`` operation.
  430. `#1709 <https://github.com/pybind/pybind11/pull/1709>`_,
  431. * CMake build system improvements for projects that include non-C++
  432. files (e.g. plain C, CUDA) in ``pybind11_add_module`` et al.
  433. `#1678 <https://github.com/pybind/pybind11/pull/1678>`_.
  434. * Fixed asynchronous invocation and deallocation of Python functions
  435. wrapped in ``std::function``.
  436. `#1595 <https://github.com/pybind/pybind11/pull/1595>`_.
  437. * Fixes regarding return value policy propagation in STL type casters.
  438. `#1603 <https://github.com/pybind/pybind11/pull/1603>`_.
  439. * Fixed scoped enum comparisons.
  440. `#1571 <https://github.com/pybind/pybind11/pull/1571>`_.
  441. * Fixed iostream redirection for code that releases the GIL.
  442. `#1368 <https://github.com/pybind/pybind11/pull/1368>`_,
  443. * A number of CI-related fixes.
  444. `#1757 <https://github.com/pybind/pybind11/pull/1757>`_,
  445. `#1744 <https://github.com/pybind/pybind11/pull/1744>`_,
  446. `#1670 <https://github.com/pybind/pybind11/pull/1670>`_.
  447. v2.2.4 (September 11, 2018)
  448. -----------------------------------------------------
  449. * Use new Python 3.7 Thread Specific Storage (TSS) implementation if available.
  450. `#1454 <https://github.com/pybind/pybind11/pull/1454>`_,
  451. `#1517 <https://github.com/pybind/pybind11/pull/1517>`_.
  452. * Fixes for newer MSVC versions and C++17 mode.
  453. `#1347 <https://github.com/pybind/pybind11/pull/1347>`_,
  454. `#1462 <https://github.com/pybind/pybind11/pull/1462>`_.
  455. * Propagate return value policies to type-specific casters
  456. when casting STL containers.
  457. `#1455 <https://github.com/pybind/pybind11/pull/1455>`_.
  458. * Allow ostream-redirection of more than 1024 characters.
  459. `#1479 <https://github.com/pybind/pybind11/pull/1479>`_.
  460. * Set ``Py_DEBUG`` define when compiling against a debug Python build.
  461. `#1438 <https://github.com/pybind/pybind11/pull/1438>`_.
  462. * Untangle integer logic in number type caster to work for custom
  463. types that may only be castable to a restricted set of builtin types.
  464. `#1442 <https://github.com/pybind/pybind11/pull/1442>`_.
  465. * CMake build system: Remember Python version in cache file.
  466. `#1434 <https://github.com/pybind/pybind11/pull/1434>`_.
  467. * Fix for custom smart pointers: use ``std::addressof`` to obtain holder
  468. address instead of ``operator&``.
  469. `#1435 <https://github.com/pybind/pybind11/pull/1435>`_.
  470. * Properly report exceptions thrown during module initialization.
  471. `#1362 <https://github.com/pybind/pybind11/pull/1362>`_.
  472. * Fixed a segmentation fault when creating empty-shaped NumPy array.
  473. `#1371 <https://github.com/pybind/pybind11/pull/1371>`_.
  474. * The version of Intel C++ compiler must be >= 2017, and this is now checked by
  475. the header files. `#1363 <https://github.com/pybind/pybind11/pull/1363>`_.
  476. * A few minor typo fixes and improvements to the test suite, and
  477. patches that silence compiler warnings.
  478. * Vectors now support construction from generators, as well as ``extend()`` from a
  479. list or generator.
  480. `#1496 <https://github.com/pybind/pybind11/pull/1496>`_.
  481. v2.2.3 (April 29, 2018)
  482. -----------------------------------------------------
  483. * The pybind11 header location detection was replaced by a new implementation
  484. that no longer depends on ``pip`` internals (the recently released ``pip``
  485. 10 has restricted access to this API).
  486. `#1190 <https://github.com/pybind/pybind11/pull/1190>`_.
  487. * Small adjustment to an implementation detail to work around a compiler segmentation fault in Clang 3.3/3.4.
  488. `#1350 <https://github.com/pybind/pybind11/pull/1350>`_.
  489. * The minimal supported version of the Intel compiler was >= 17.0 since
  490. pybind11 v2.1. This check is now explicit, and a compile-time error is raised
  491. if the compiler meet the requirement.
  492. `#1363 <https://github.com/pybind/pybind11/pull/1363>`_.
  493. * Fixed an endianness-related fault in the test suite.
  494. `#1287 <https://github.com/pybind/pybind11/pull/1287>`_.
  495. v2.2.2 (February 7, 2018)
  496. -----------------------------------------------------
  497. * Fixed a segfault when combining embedded interpreter
  498. shutdown/reinitialization with external loaded pybind11 modules.
  499. `#1092 <https://github.com/pybind/pybind11/pull/1092>`_.
  500. * Eigen support: fixed a bug where Nx1/1xN numpy inputs couldn't be passed as
  501. arguments to Eigen vectors (which for Eigen are simply compile-time fixed
  502. Nx1/1xN matrices).
  503. `#1106 <https://github.com/pybind/pybind11/pull/1106>`_.
  504. * Clarified to license by moving the licensing of contributions from
  505. ``LICENSE`` into ``CONTRIBUTING.md``: the licensing of contributions is not
  506. actually part of the software license as distributed. This isn't meant to be
  507. a substantial change in the licensing of the project, but addresses concerns
  508. that the clause made the license non-standard.
  509. `#1109 <https://github.com/pybind/pybind11/issues/1109>`_.
  510. * Fixed a regression introduced in 2.1 that broke binding functions with lvalue
  511. character literal arguments.
  512. `#1128 <https://github.com/pybind/pybind11/pull/1128>`_.
  513. * MSVC: fix for compilation failures under /permissive-, and added the flag to
  514. the appveyor test suite.
  515. `#1155 <https://github.com/pybind/pybind11/pull/1155>`_.
  516. * Fixed ``__qualname__`` generation, and in turn, fixes how class names
  517. (especially nested class names) are shown in generated docstrings.
  518. `#1171 <https://github.com/pybind/pybind11/pull/1171>`_.
  519. * Updated the FAQ with a suggested project citation reference.
  520. `#1189 <https://github.com/pybind/pybind11/pull/1189>`_.
  521. * Added fixes for deprecation warnings when compiled under C++17 with
  522. ``-Wdeprecated`` turned on, and add ``-Wdeprecated`` to the test suite
  523. compilation flags.
  524. `#1191 <https://github.com/pybind/pybind11/pull/1191>`_.
  525. * Fixed outdated PyPI URLs in ``setup.py``.
  526. `#1213 <https://github.com/pybind/pybind11/pull/1213>`_.
  527. * Fixed a refcount leak for arguments that end up in a ``py::args`` argument
  528. for functions with both fixed positional and ``py::args`` arguments.
  529. `#1216 <https://github.com/pybind/pybind11/pull/1216>`_.
  530. * Fixed a potential segfault resulting from possible premature destruction of
  531. ``py::args``/``py::kwargs`` arguments with overloaded functions.
  532. `#1223 <https://github.com/pybind/pybind11/pull/1223>`_.
  533. * Fixed ``del map[item]`` for a ``stl_bind.h`` bound stl map.
  534. `#1229 <https://github.com/pybind/pybind11/pull/1229>`_.
  535. * Fixed a regression from v2.1.x where the aggregate initialization could
  536. unintentionally end up at a constructor taking a templated
  537. ``std::initializer_list<T>`` argument.
  538. `#1249 <https://github.com/pybind/pybind11/pull/1249>`_.
  539. * Fixed an issue where calling a function with a keep_alive policy on the same
  540. nurse/patient pair would cause the internal patient storage to needlessly
  541. grow (unboundedly, if the nurse is long-lived).
  542. `#1251 <https://github.com/pybind/pybind11/issues/1251>`_.
  543. * Various other minor fixes.
  544. v2.2.1 (September 14, 2017)
  545. -----------------------------------------------------
  546. * Added ``py::module_::reload()`` member function for reloading a module.
  547. `#1040 <https://github.com/pybind/pybind11/pull/1040>`_.
  548. * Fixed a reference leak in the number converter.
  549. `#1078 <https://github.com/pybind/pybind11/pull/1078>`_.
  550. * Fixed compilation with Clang on host GCC < 5 (old libstdc++ which isn't fully
  551. C++11 compliant). `#1062 <https://github.com/pybind/pybind11/pull/1062>`_.
  552. * Fixed a regression where the automatic ``std::vector<bool>`` caster would
  553. fail to compile. The same fix also applies to any container which returns
  554. element proxies instead of references.
  555. `#1053 <https://github.com/pybind/pybind11/pull/1053>`_.
  556. * Fixed a regression where the ``py::keep_alive`` policy could not be applied
  557. to constructors. `#1065 <https://github.com/pybind/pybind11/pull/1065>`_.
  558. * Fixed a nullptr dereference when loading a ``py::module_local`` type
  559. that's only registered in an external module.
  560. `#1058 <https://github.com/pybind/pybind11/pull/1058>`_.
  561. * Fixed implicit conversion of accessors to types derived from ``py::object``.
  562. `#1076 <https://github.com/pybind/pybind11/pull/1076>`_.
  563. * The ``name`` in ``PYBIND11_MODULE(name, variable)`` can now be a macro.
  564. `#1082 <https://github.com/pybind/pybind11/pull/1082>`_.
  565. * Relaxed overly strict ``py::pickle()`` check for matching get and set types.
  566. `#1064 <https://github.com/pybind/pybind11/pull/1064>`_.
  567. * Conversion errors now try to be more informative when it's likely that
  568. a missing header is the cause (e.g. forgetting ``<pybind11/stl.h>``).
  569. `#1077 <https://github.com/pybind/pybind11/pull/1077>`_.
  570. v2.2.0 (August 31, 2017)
  571. -----------------------------------------------------
  572. * Support for embedding the Python interpreter. See the
  573. :doc:`documentation page </advanced/embedding>` for a
  574. full overview of the new features.
  575. `#774 <https://github.com/pybind/pybind11/pull/774>`_,
  576. `#889 <https://github.com/pybind/pybind11/pull/889>`_,
  577. `#892 <https://github.com/pybind/pybind11/pull/892>`_,
  578. `#920 <https://github.com/pybind/pybind11/pull/920>`_.
  579. .. code-block:: cpp
  580. #include <pybind11/embed.h>
  581. namespace py = pybind11;
  582. int main() {
  583. py::scoped_interpreter guard{}; // start the interpreter and keep it alive
  584. py::print("Hello, World!"); // use the Python API
  585. }
  586. * Support for inheriting from multiple C++ bases in Python.
  587. `#693 <https://github.com/pybind/pybind11/pull/693>`_.
  588. .. code-block:: python
  589. from cpp_module import CppBase1, CppBase2
  590. class PyDerived(CppBase1, CppBase2):
  591. def __init__(self):
  592. CppBase1.__init__(self) # C++ bases must be initialized explicitly
  593. CppBase2.__init__(self)
  594. * ``PYBIND11_MODULE`` is now the preferred way to create module entry points.
  595. ``PYBIND11_PLUGIN`` is deprecated. See :ref:`macros` for details.
  596. `#879 <https://github.com/pybind/pybind11/pull/879>`_.
  597. .. code-block:: cpp
  598. // new
  599. PYBIND11_MODULE(example, m) {
  600. m.def("add", [](int a, int b) { return a + b; });
  601. }
  602. // old
  603. PYBIND11_PLUGIN(example) {
  604. py::module m("example");
  605. m.def("add", [](int a, int b) { return a + b; });
  606. return m.ptr();
  607. }
  608. * pybind11's headers and build system now more strictly enforce hidden symbol
  609. visibility for extension modules. This should be seamless for most users,
  610. but see the :doc:`upgrade` if you use a custom build system.
  611. `#995 <https://github.com/pybind/pybind11/pull/995>`_.
  612. * Support for ``py::module_local`` types which allow multiple modules to
  613. export the same C++ types without conflicts. This is useful for opaque
  614. types like ``std::vector<int>``. ``py::bind_vector`` and ``py::bind_map``
  615. now default to ``py::module_local`` if their elements are builtins or
  616. local types. See :ref:`module_local` for details.
  617. `#949 <https://github.com/pybind/pybind11/pull/949>`_,
  618. `#981 <https://github.com/pybind/pybind11/pull/981>`_,
  619. `#995 <https://github.com/pybind/pybind11/pull/995>`_,
  620. `#997 <https://github.com/pybind/pybind11/pull/997>`_.
  621. * Custom constructors can now be added very easily using lambdas or factory
  622. functions which return a class instance by value, pointer or holder. This
  623. supersedes the old placement-new ``__init__`` technique.
  624. See :ref:`custom_constructors` for details.
  625. `#805 <https://github.com/pybind/pybind11/pull/805>`_,
  626. `#1014 <https://github.com/pybind/pybind11/pull/1014>`_.
  627. .. code-block:: cpp
  628. struct Example {
  629. Example(std::string);
  630. };
  631. py::class_<Example>(m, "Example")
  632. .def(py::init<std::string>()) // existing constructor
  633. .def(py::init([](int n) { // custom constructor
  634. return std::make_unique<Example>(std::to_string(n));
  635. }));
  636. * Similarly to custom constructors, pickling support functions are now bound
  637. using the ``py::pickle()`` adaptor which improves type safety. See the
  638. :doc:`upgrade` and :ref:`pickling` for details.
  639. `#1038 <https://github.com/pybind/pybind11/pull/1038>`_.
  640. * Builtin support for converting C++17 standard library types and general
  641. conversion improvements:
  642. 1. C++17 ``std::variant`` is supported right out of the box. C++11/14
  643. equivalents (e.g. ``boost::variant``) can also be added with a simple
  644. user-defined specialization. See :ref:`cpp17_container_casters` for details.
  645. `#811 <https://github.com/pybind/pybind11/pull/811>`_,
  646. `#845 <https://github.com/pybind/pybind11/pull/845>`_,
  647. `#989 <https://github.com/pybind/pybind11/pull/989>`_.
  648. 2. Out-of-the-box support for C++17 ``std::string_view``.
  649. `#906 <https://github.com/pybind/pybind11/pull/906>`_.
  650. 3. Improved compatibility of the builtin ``optional`` converter.
  651. `#874 <https://github.com/pybind/pybind11/pull/874>`_.
  652. 4. The ``bool`` converter now accepts ``numpy.bool_`` and types which
  653. define ``__bool__`` (Python 3.x) or ``__nonzero__`` (Python 2.7).
  654. `#925 <https://github.com/pybind/pybind11/pull/925>`_.
  655. 5. C++-to-Python casters are now more efficient and move elements out
  656. of rvalue containers whenever possible.
  657. `#851 <https://github.com/pybind/pybind11/pull/851>`_,
  658. `#936 <https://github.com/pybind/pybind11/pull/936>`_,
  659. `#938 <https://github.com/pybind/pybind11/pull/938>`_.
  660. 6. Fixed ``bytes`` to ``std::string/char*`` conversion on Python 3.
  661. `#817 <https://github.com/pybind/pybind11/pull/817>`_.
  662. 7. Fixed lifetime of temporary C++ objects created in Python-to-C++ conversions.
  663. `#924 <https://github.com/pybind/pybind11/pull/924>`_.
  664. * Scope guard call policy for RAII types, e.g. ``py::call_guard<py::gil_scoped_release>()``,
  665. ``py::call_guard<py::scoped_ostream_redirect>()``. See :ref:`call_policies` for details.
  666. `#740 <https://github.com/pybind/pybind11/pull/740>`_.
  667. * Utility for redirecting C++ streams to Python (e.g. ``std::cout`` ->
  668. ``sys.stdout``). Scope guard ``py::scoped_ostream_redirect`` in C++ and
  669. a context manager in Python. See :ref:`ostream_redirect`.
  670. `#1009 <https://github.com/pybind/pybind11/pull/1009>`_.
  671. * Improved handling of types and exceptions across module boundaries.
  672. `#915 <https://github.com/pybind/pybind11/pull/915>`_,
  673. `#951 <https://github.com/pybind/pybind11/pull/951>`_,
  674. `#995 <https://github.com/pybind/pybind11/pull/995>`_.
  675. * Fixed destruction order of ``py::keep_alive`` nurse/patient objects
  676. in reference cycles.
  677. `#856 <https://github.com/pybind/pybind11/pull/856>`_.
  678. * NumPy and buffer protocol related improvements:
  679. 1. Support for negative strides in Python buffer objects/numpy arrays. This
  680. required changing integers from unsigned to signed for the related C++ APIs.
  681. Note: If you have compiler warnings enabled, you may notice some new conversion
  682. warnings after upgrading. These can be resolved with ``static_cast``.
  683. `#782 <https://github.com/pybind/pybind11/pull/782>`_.
  684. 2. Support ``std::complex`` and arrays inside ``PYBIND11_NUMPY_DTYPE``.
  685. `#831 <https://github.com/pybind/pybind11/pull/831>`_,
  686. `#832 <https://github.com/pybind/pybind11/pull/832>`_.
  687. 3. Support for constructing ``py::buffer_info`` and ``py::arrays`` using
  688. arbitrary containers or iterators instead of requiring a ``std::vector``.
  689. `#788 <https://github.com/pybind/pybind11/pull/788>`_,
  690. `#822 <https://github.com/pybind/pybind11/pull/822>`_,
  691. `#860 <https://github.com/pybind/pybind11/pull/860>`_.
  692. 4. Explicitly check numpy version and require >= 1.7.0.
  693. `#819 <https://github.com/pybind/pybind11/pull/819>`_.
  694. * Support for allowing/prohibiting ``None`` for specific arguments and improved
  695. ``None`` overload resolution order. See :ref:`none_arguments` for details.
  696. `#843 <https://github.com/pybind/pybind11/pull/843>`_.
  697. `#859 <https://github.com/pybind/pybind11/pull/859>`_.
  698. * Added ``py::exec()`` as a shortcut for ``py::eval<py::eval_statements>()``
  699. and support for C++11 raw string literals as input. See :ref:`eval`.
  700. `#766 <https://github.com/pybind/pybind11/pull/766>`_,
  701. `#827 <https://github.com/pybind/pybind11/pull/827>`_.
  702. * ``py::vectorize()`` ignores non-vectorizable arguments and supports
  703. member functions.
  704. `#762 <https://github.com/pybind/pybind11/pull/762>`_.
  705. * Support for bound methods as callbacks (``pybind11/functional.h``).
  706. `#815 <https://github.com/pybind/pybind11/pull/815>`_.
  707. * Allow aliasing pybind11 methods: ``cls.attr("foo") = cls.attr("bar")``.
  708. `#802 <https://github.com/pybind/pybind11/pull/802>`_.
  709. * Don't allow mixed static/non-static overloads.
  710. `#804 <https://github.com/pybind/pybind11/pull/804>`_.
  711. * Fixed overriding static properties in derived classes.
  712. `#784 <https://github.com/pybind/pybind11/pull/784>`_.
  713. * Added support for write only properties.
  714. `#1144 <https://github.com/pybind/pybind11/pull/1144>`_.
  715. * Improved deduction of member functions of a derived class when its bases
  716. aren't registered with pybind11.
  717. `#855 <https://github.com/pybind/pybind11/pull/855>`_.
  718. .. code-block:: cpp
  719. struct Base {
  720. int foo() { return 42; }
  721. }
  722. struct Derived : Base {}
  723. // Now works, but previously required also binding `Base`
  724. py::class_<Derived>(m, "Derived")
  725. .def("foo", &Derived::foo); // function is actually from `Base`
  726. * The implementation of ``py::init<>`` now uses C++11 brace initialization
  727. syntax to construct instances, which permits binding implicit constructors of
  728. aggregate types. `#1015 <https://github.com/pybind/pybind11/pull/1015>`_.
  729. .. code-block:: cpp
  730. struct Aggregate {
  731. int a;
  732. std::string b;
  733. };
  734. py::class_<Aggregate>(m, "Aggregate")
  735. .def(py::init<int, const std::string &>());
  736. * Fixed issues with multiple inheritance with offset base/derived pointers.
  737. `#812 <https://github.com/pybind/pybind11/pull/812>`_,
  738. `#866 <https://github.com/pybind/pybind11/pull/866>`_,
  739. `#960 <https://github.com/pybind/pybind11/pull/960>`_.
  740. * Fixed reference leak of type objects.
  741. `#1030 <https://github.com/pybind/pybind11/pull/1030>`_.
  742. * Improved support for the ``/std:c++14`` and ``/std:c++latest`` modes
  743. on MSVC 2017.
  744. `#841 <https://github.com/pybind/pybind11/pull/841>`_,
  745. `#999 <https://github.com/pybind/pybind11/pull/999>`_.
  746. * Fixed detection of private operator new on MSVC.
  747. `#893 <https://github.com/pybind/pybind11/pull/893>`_,
  748. `#918 <https://github.com/pybind/pybind11/pull/918>`_.
  749. * Intel C++ compiler compatibility fixes.
  750. `#937 <https://github.com/pybind/pybind11/pull/937>`_.
  751. * Fixed implicit conversion of `py::enum_` to integer types on Python 2.7.
  752. `#821 <https://github.com/pybind/pybind11/pull/821>`_.
  753. * Added ``py::hash`` to fetch the hash value of Python objects, and
  754. ``.def(hash(py::self))`` to provide the C++ ``std::hash`` as the Python
  755. ``__hash__`` method.
  756. `#1034 <https://github.com/pybind/pybind11/pull/1034>`_.
  757. * Fixed ``__truediv__`` on Python 2 and ``__itruediv__`` on Python 3.
  758. `#867 <https://github.com/pybind/pybind11/pull/867>`_.
  759. * ``py::capsule`` objects now support the ``name`` attribute. This is useful
  760. for interfacing with ``scipy.LowLevelCallable``.
  761. `#902 <https://github.com/pybind/pybind11/pull/902>`_.
  762. * Fixed ``py::make_iterator``'s ``__next__()`` for past-the-end calls.
  763. `#897 <https://github.com/pybind/pybind11/pull/897>`_.
  764. * Added ``error_already_set::matches()`` for checking Python exceptions.
  765. `#772 <https://github.com/pybind/pybind11/pull/772>`_.
  766. * Deprecated ``py::error_already_set::clear()``. It's no longer needed
  767. following a simplification of the ``py::error_already_set`` class.
  768. `#954 <https://github.com/pybind/pybind11/pull/954>`_.
  769. * Deprecated ``py::handle::operator==()`` in favor of ``py::handle::is()``
  770. `#825 <https://github.com/pybind/pybind11/pull/825>`_.
  771. * Deprecated ``py::object::borrowed``/``py::object::stolen``.
  772. Use ``py::object::borrowed_t{}``/``py::object::stolen_t{}`` instead.
  773. `#771 <https://github.com/pybind/pybind11/pull/771>`_.
  774. * Changed internal data structure versioning to avoid conflicts between
  775. modules compiled with different revisions of pybind11.
  776. `#1012 <https://github.com/pybind/pybind11/pull/1012>`_.
  777. * Additional compile-time and run-time error checking and more informative messages.
  778. `#786 <https://github.com/pybind/pybind11/pull/786>`_,
  779. `#794 <https://github.com/pybind/pybind11/pull/794>`_,
  780. `#803 <https://github.com/pybind/pybind11/pull/803>`_.
  781. * Various minor improvements and fixes.
  782. `#764 <https://github.com/pybind/pybind11/pull/764>`_,
  783. `#791 <https://github.com/pybind/pybind11/pull/791>`_,
  784. `#795 <https://github.com/pybind/pybind11/pull/795>`_,
  785. `#840 <https://github.com/pybind/pybind11/pull/840>`_,
  786. `#844 <https://github.com/pybind/pybind11/pull/844>`_,
  787. `#846 <https://github.com/pybind/pybind11/pull/846>`_,
  788. `#849 <https://github.com/pybind/pybind11/pull/849>`_,
  789. `#858 <https://github.com/pybind/pybind11/pull/858>`_,
  790. `#862 <https://github.com/pybind/pybind11/pull/862>`_,
  791. `#871 <https://github.com/pybind/pybind11/pull/871>`_,
  792. `#872 <https://github.com/pybind/pybind11/pull/872>`_,
  793. `#881 <https://github.com/pybind/pybind11/pull/881>`_,
  794. `#888 <https://github.com/pybind/pybind11/pull/888>`_,
  795. `#899 <https://github.com/pybind/pybind11/pull/899>`_,
  796. `#928 <https://github.com/pybind/pybind11/pull/928>`_,
  797. `#931 <https://github.com/pybind/pybind11/pull/931>`_,
  798. `#944 <https://github.com/pybind/pybind11/pull/944>`_,
  799. `#950 <https://github.com/pybind/pybind11/pull/950>`_,
  800. `#952 <https://github.com/pybind/pybind11/pull/952>`_,
  801. `#962 <https://github.com/pybind/pybind11/pull/962>`_,
  802. `#965 <https://github.com/pybind/pybind11/pull/965>`_,
  803. `#970 <https://github.com/pybind/pybind11/pull/970>`_,
  804. `#978 <https://github.com/pybind/pybind11/pull/978>`_,
  805. `#979 <https://github.com/pybind/pybind11/pull/979>`_,
  806. `#986 <https://github.com/pybind/pybind11/pull/986>`_,
  807. `#1020 <https://github.com/pybind/pybind11/pull/1020>`_,
  808. `#1027 <https://github.com/pybind/pybind11/pull/1027>`_,
  809. `#1037 <https://github.com/pybind/pybind11/pull/1037>`_.
  810. * Testing improvements.
  811. `#798 <https://github.com/pybind/pybind11/pull/798>`_,
  812. `#882 <https://github.com/pybind/pybind11/pull/882>`_,
  813. `#898 <https://github.com/pybind/pybind11/pull/898>`_,
  814. `#900 <https://github.com/pybind/pybind11/pull/900>`_,
  815. `#921 <https://github.com/pybind/pybind11/pull/921>`_,
  816. `#923 <https://github.com/pybind/pybind11/pull/923>`_,
  817. `#963 <https://github.com/pybind/pybind11/pull/963>`_.
  818. v2.1.1 (April 7, 2017)
  819. -----------------------------------------------------
  820. * Fixed minimum version requirement for MSVC 2015u3
  821. `#773 <https://github.com/pybind/pybind11/pull/773>`_.
  822. v2.1.0 (March 22, 2017)
  823. -----------------------------------------------------
  824. * pybind11 now performs function overload resolution in two phases. The first
  825. phase only considers exact type matches, while the second allows for implicit
  826. conversions to take place. A special ``noconvert()`` syntax can be used to
  827. completely disable implicit conversions for specific arguments.
  828. `#643 <https://github.com/pybind/pybind11/pull/643>`_,
  829. `#634 <https://github.com/pybind/pybind11/pull/634>`_,
  830. `#650 <https://github.com/pybind/pybind11/pull/650>`_.
  831. * Fixed a regression where static properties no longer worked with classes
  832. using multiple inheritance. The ``py::metaclass`` attribute is no longer
  833. necessary (and deprecated as of this release) when binding classes with
  834. static properties.
  835. `#679 <https://github.com/pybind/pybind11/pull/679>`_,
  836. * Classes bound using ``pybind11`` can now use custom metaclasses.
  837. `#679 <https://github.com/pybind/pybind11/pull/679>`_,
  838. * ``py::args`` and ``py::kwargs`` can now be mixed with other positional
  839. arguments when binding functions using pybind11.
  840. `#611 <https://github.com/pybind/pybind11/pull/611>`_.
  841. * Improved support for C++11 unicode string and character types; added
  842. extensive documentation regarding pybind11's string conversion behavior.
  843. `#624 <https://github.com/pybind/pybind11/pull/624>`_,
  844. `#636 <https://github.com/pybind/pybind11/pull/636>`_,
  845. `#715 <https://github.com/pybind/pybind11/pull/715>`_.
  846. * pybind11 can now avoid expensive copies when converting Eigen arrays to NumPy
  847. arrays (and vice versa). `#610 <https://github.com/pybind/pybind11/pull/610>`_.
  848. * The "fast path" in ``py::vectorize`` now works for any full-size group of C or
  849. F-contiguous arrays. The non-fast path is also faster since it no longer performs
  850. copies of the input arguments (except when type conversions are necessary).
  851. `#610 <https://github.com/pybind/pybind11/pull/610>`_.
  852. * Added fast, unchecked access to NumPy arrays via a proxy object.
  853. `#746 <https://github.com/pybind/pybind11/pull/746>`_.
  854. * Transparent support for class-specific ``operator new`` and
  855. ``operator delete`` implementations.
  856. `#755 <https://github.com/pybind/pybind11/pull/755>`_.
  857. * Slimmer and more efficient STL-compatible iterator interface for sequence types.
  858. `#662 <https://github.com/pybind/pybind11/pull/662>`_.
  859. * Improved custom holder type support.
  860. `#607 <https://github.com/pybind/pybind11/pull/607>`_.
  861. * ``nullptr`` to ``None`` conversion fixed in various builtin type casters.
  862. `#732 <https://github.com/pybind/pybind11/pull/732>`_.
  863. * ``enum_`` now exposes its members via a special ``__members__`` attribute.
  864. `#666 <https://github.com/pybind/pybind11/pull/666>`_.
  865. * ``std::vector`` bindings created using ``stl_bind.h`` can now optionally
  866. implement the buffer protocol. `#488 <https://github.com/pybind/pybind11/pull/488>`_.
  867. * Automated C++ reference documentation using doxygen and breathe.
  868. `#598 <https://github.com/pybind/pybind11/pull/598>`_.
  869. * Added minimum compiler version assertions.
  870. `#727 <https://github.com/pybind/pybind11/pull/727>`_.
  871. * Improved compatibility with C++1z.
  872. `#677 <https://github.com/pybind/pybind11/pull/677>`_.
  873. * Improved ``py::capsule`` API. Can be used to implement cleanup
  874. callbacks that are involved at module destruction time.
  875. `#752 <https://github.com/pybind/pybind11/pull/752>`_.
  876. * Various minor improvements and fixes.
  877. `#595 <https://github.com/pybind/pybind11/pull/595>`_,
  878. `#588 <https://github.com/pybind/pybind11/pull/588>`_,
  879. `#589 <https://github.com/pybind/pybind11/pull/589>`_,
  880. `#603 <https://github.com/pybind/pybind11/pull/603>`_,
  881. `#619 <https://github.com/pybind/pybind11/pull/619>`_,
  882. `#648 <https://github.com/pybind/pybind11/pull/648>`_,
  883. `#695 <https://github.com/pybind/pybind11/pull/695>`_,
  884. `#720 <https://github.com/pybind/pybind11/pull/720>`_,
  885. `#723 <https://github.com/pybind/pybind11/pull/723>`_,
  886. `#729 <https://github.com/pybind/pybind11/pull/729>`_,
  887. `#724 <https://github.com/pybind/pybind11/pull/724>`_,
  888. `#742 <https://github.com/pybind/pybind11/pull/742>`_,
  889. `#753 <https://github.com/pybind/pybind11/pull/753>`_.
  890. v2.0.1 (Jan 4, 2017)
  891. -----------------------------------------------------
  892. * Fix pointer to reference error in type_caster on MSVC
  893. `#583 <https://github.com/pybind/pybind11/pull/583>`_.
  894. * Fixed a segmentation in the test suite due to a typo
  895. `cd7eac <https://github.com/pybind/pybind11/commit/cd7eac>`_.
  896. v2.0.0 (Jan 1, 2017)
  897. -----------------------------------------------------
  898. * Fixed a reference counting regression affecting types with custom metaclasses
  899. (introduced in v2.0.0-rc1).
  900. `#571 <https://github.com/pybind/pybind11/pull/571>`_.
  901. * Quenched a CMake policy warning.
  902. `#570 <https://github.com/pybind/pybind11/pull/570>`_.
  903. v2.0.0-rc1 (Dec 23, 2016)
  904. -----------------------------------------------------
  905. The pybind11 developers are excited to issue a release candidate of pybind11
  906. with a subsequent v2.0.0 release planned in early January next year.
  907. An incredible amount of effort by went into pybind11 over the last ~5 months,
  908. leading to a release that is jam-packed with exciting new features and numerous
  909. usability improvements. The following list links PRs or individual commits
  910. whenever applicable.
  911. Happy Christmas!
  912. * Support for binding C++ class hierarchies that make use of multiple
  913. inheritance. `#410 <https://github.com/pybind/pybind11/pull/410>`_.
  914. * PyPy support: pybind11 now supports nightly builds of PyPy and will
  915. interoperate with the future 5.7 release. No code changes are necessary,
  916. everything "just" works as usual. Note that we only target the Python 2.7
  917. branch for now; support for 3.x will be added once its ``cpyext`` extension
  918. support catches up. A few minor features remain unsupported for the time
  919. being (notably dynamic attributes in custom types).
  920. `#527 <https://github.com/pybind/pybind11/pull/527>`_.
  921. * Significant work on the documentation -- in particular, the monolithic
  922. ``advanced.rst`` file was restructured into a easier to read hierarchical
  923. organization. `#448 <https://github.com/pybind/pybind11/pull/448>`_.
  924. * Many NumPy-related improvements:
  925. 1. Object-oriented API to access and modify NumPy ``ndarray`` instances,
  926. replicating much of the corresponding NumPy C API functionality.
  927. `#402 <https://github.com/pybind/pybind11/pull/402>`_.
  928. 2. NumPy array ``dtype`` array descriptors are now first-class citizens and
  929. are exposed via a new class ``py::dtype``.
  930. 3. Structured dtypes can be registered using the ``PYBIND11_NUMPY_DTYPE()``
  931. macro. Special ``array`` constructors accepting dtype objects were also
  932. added.
  933. One potential caveat involving this change: format descriptor strings
  934. should now be accessed via ``format_descriptor::format()`` (however, for
  935. compatibility purposes, the old syntax ``format_descriptor::value`` will
  936. still work for non-structured data types). `#308
  937. <https://github.com/pybind/pybind11/pull/308>`_.
  938. 4. Further improvements to support structured dtypes throughout the system.
  939. `#472 <https://github.com/pybind/pybind11/pull/472>`_,
  940. `#474 <https://github.com/pybind/pybind11/pull/474>`_,
  941. `#459 <https://github.com/pybind/pybind11/pull/459>`_,
  942. `#453 <https://github.com/pybind/pybind11/pull/453>`_,
  943. `#452 <https://github.com/pybind/pybind11/pull/452>`_, and
  944. `#505 <https://github.com/pybind/pybind11/pull/505>`_.
  945. 5. Fast access operators. `#497 <https://github.com/pybind/pybind11/pull/497>`_.
  946. 6. Constructors for arrays whose storage is owned by another object.
  947. `#440 <https://github.com/pybind/pybind11/pull/440>`_.
  948. 7. Added constructors for ``array`` and ``array_t`` explicitly accepting shape
  949. and strides; if strides are not provided, they are deduced assuming
  950. C-contiguity. Also added simplified constructors for 1-dimensional case.
  951. 8. Added buffer/NumPy support for ``char[N]`` and ``std::array<char, N>`` types.
  952. 9. Added ``memoryview`` wrapper type which is constructible from ``buffer_info``.
  953. * Eigen: many additional conversions and support for non-contiguous
  954. arrays/slices.
  955. `#427 <https://github.com/pybind/pybind11/pull/427>`_,
  956. `#315 <https://github.com/pybind/pybind11/pull/315>`_,
  957. `#316 <https://github.com/pybind/pybind11/pull/316>`_,
  958. `#312 <https://github.com/pybind/pybind11/pull/312>`_, and
  959. `#267 <https://github.com/pybind/pybind11/pull/267>`_
  960. * Incompatible changes in ``class_<...>::class_()``:
  961. 1. Declarations of types that provide access via the buffer protocol must
  962. now include the ``py::buffer_protocol()`` annotation as an argument to
  963. the ``class_`` constructor.
  964. 2. Declarations of types that require a custom metaclass (i.e. all classes
  965. which include static properties via commands such as
  966. ``def_readwrite_static()``) must now include the ``py::metaclass()``
  967. annotation as an argument to the ``class_`` constructor.
  968. These two changes were necessary to make type definitions in pybind11
  969. future-proof, and to support PyPy via its cpyext mechanism. `#527
  970. <https://github.com/pybind/pybind11/pull/527>`_.
  971. 3. This version of pybind11 uses a redesigned mechanism for instantiating
  972. trampoline classes that are used to override virtual methods from within
  973. Python. This led to the following user-visible syntax change: instead of
  974. .. code-block:: cpp
  975. py::class_<TrampolineClass>("MyClass")
  976. .alias<MyClass>()
  977. ....
  978. write
  979. .. code-block:: cpp
  980. py::class_<MyClass, TrampolineClass>("MyClass")
  981. ....
  982. Importantly, both the original and the trampoline class are now
  983. specified as an arguments (in arbitrary order) to the ``py::class_``
  984. template, and the ``alias<..>()`` call is gone. The new scheme has zero
  985. overhead in cases when Python doesn't override any functions of the
  986. underlying C++ class. `rev. 86d825
  987. <https://github.com/pybind/pybind11/commit/86d825>`_.
  988. * Added ``eval`` and ``eval_file`` functions for evaluating expressions and
  989. statements from a string or file. `rev. 0d3fc3
  990. <https://github.com/pybind/pybind11/commit/0d3fc3>`_.
  991. * pybind11 can now create types with a modifiable dictionary.
  992. `#437 <https://github.com/pybind/pybind11/pull/437>`_ and
  993. `#444 <https://github.com/pybind/pybind11/pull/444>`_.
  994. * Support for translation of arbitrary C++ exceptions to Python counterparts.
  995. `#296 <https://github.com/pybind/pybind11/pull/296>`_ and
  996. `#273 <https://github.com/pybind/pybind11/pull/273>`_.
  997. * Report full backtraces through mixed C++/Python code, better reporting for
  998. import errors, fixed GIL management in exception processing.
  999. `#537 <https://github.com/pybind/pybind11/pull/537>`_,
  1000. `#494 <https://github.com/pybind/pybind11/pull/494>`_,
  1001. `rev. e72d95 <https://github.com/pybind/pybind11/commit/e72d95>`_, and
  1002. `rev. 099d6e <https://github.com/pybind/pybind11/commit/099d6e>`_.
  1003. * Support for bit-level operations, comparisons, and serialization of C++
  1004. enumerations. `#503 <https://github.com/pybind/pybind11/pull/503>`_,
  1005. `#508 <https://github.com/pybind/pybind11/pull/508>`_,
  1006. `#380 <https://github.com/pybind/pybind11/pull/380>`_,
  1007. `#309 <https://github.com/pybind/pybind11/pull/309>`_.
  1008. `#311 <https://github.com/pybind/pybind11/pull/311>`_.
  1009. * The ``class_`` constructor now accepts its template arguments in any order.
  1010. `#385 <https://github.com/pybind/pybind11/pull/385>`_.
  1011. * Attribute and item accessors now have a more complete interface which makes
  1012. it possible to chain attributes as in
  1013. ``obj.attr("a")[key].attr("b").attr("method")(1, 2, 3)``. `#425
  1014. <https://github.com/pybind/pybind11/pull/425>`_.
  1015. * Major redesign of the default and conversion constructors in ``pytypes.h``.
  1016. `#464 <https://github.com/pybind/pybind11/pull/464>`_.
  1017. * Added built-in support for ``std::shared_ptr`` holder type. It is no longer
  1018. necessary to to include a declaration of the form
  1019. ``PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>)`` (though continuing to
  1020. do so won't cause an error).
  1021. `#454 <https://github.com/pybind/pybind11/pull/454>`_.
  1022. * New ``py::overload_cast`` casting operator to select among multiple possible
  1023. overloads of a function. An example:
  1024. .. code-block:: cpp
  1025. py::class_<Pet>(m, "Pet")
  1026. .def("set", py::overload_cast<int>(&Pet::set), "Set the pet's age")
  1027. .def("set", py::overload_cast<const std::string &>(&Pet::set), "Set the pet's name");
  1028. This feature only works on C++14-capable compilers.
  1029. `#541 <https://github.com/pybind/pybind11/pull/541>`_.
  1030. * C++ types are automatically cast to Python types, e.g. when assigning
  1031. them as an attribute. For instance, the following is now legal:
  1032. .. code-block:: cpp
  1033. py::module m = /* ... */
  1034. m.attr("constant") = 123;
  1035. (Previously, a ``py::cast`` call was necessary to avoid a compilation error.)
  1036. `#551 <https://github.com/pybind/pybind11/pull/551>`_.
  1037. * Redesigned ``pytest``-based test suite. `#321 <https://github.com/pybind/pybind11/pull/321>`_.
  1038. * Instance tracking to detect reference leaks in test suite. `#324 <https://github.com/pybind/pybind11/pull/324>`_
  1039. * pybind11 can now distinguish between multiple different instances that are
  1040. located at the same memory address, but which have different types.
  1041. `#329 <https://github.com/pybind/pybind11/pull/329>`_.
  1042. * Improved logic in ``move`` return value policy.
  1043. `#510 <https://github.com/pybind/pybind11/pull/510>`_,
  1044. `#297 <https://github.com/pybind/pybind11/pull/297>`_.
  1045. * Generalized unpacking API to permit calling Python functions from C++ using
  1046. notation such as ``foo(a1, a2, *args, "ka"_a=1, "kb"_a=2, **kwargs)``. `#372 <https://github.com/pybind/pybind11/pull/372>`_.
  1047. * ``py::print()`` function whose behavior matches that of the native Python
  1048. ``print()`` function. `#372 <https://github.com/pybind/pybind11/pull/372>`_.
  1049. * Added ``py::dict`` keyword constructor:``auto d = dict("number"_a=42,
  1050. "name"_a="World");``. `#372 <https://github.com/pybind/pybind11/pull/372>`_.
  1051. * Added ``py::str::format()`` method and ``_s`` literal: ``py::str s = "1 + 2
  1052. = {}"_s.format(3);``. `#372 <https://github.com/pybind/pybind11/pull/372>`_.
  1053. * Added ``py::repr()`` function which is equivalent to Python's builtin
  1054. ``repr()``. `#333 <https://github.com/pybind/pybind11/pull/333>`_.
  1055. * Improved construction and destruction logic for holder types. It is now
  1056. possible to reference instances with smart pointer holder types without
  1057. constructing the holder if desired. The ``PYBIND11_DECLARE_HOLDER_TYPE``
  1058. macro now accepts an optional second parameter to indicate whether the holder
  1059. type uses intrusive reference counting.
  1060. `#533 <https://github.com/pybind/pybind11/pull/533>`_ and
  1061. `#561 <https://github.com/pybind/pybind11/pull/561>`_.
  1062. * Mapping a stateless C++ function to Python and back is now "for free" (i.e.
  1063. no extra indirections or argument conversion overheads). `rev. 954b79
  1064. <https://github.com/pybind/pybind11/commit/954b79>`_.
  1065. * Bindings for ``std::valarray<T>``.
  1066. `#545 <https://github.com/pybind/pybind11/pull/545>`_.
  1067. * Improved support for C++17 capable compilers.
  1068. `#562 <https://github.com/pybind/pybind11/pull/562>`_.
  1069. * Bindings for ``std::optional<t>``.
  1070. `#475 <https://github.com/pybind/pybind11/pull/475>`_,
  1071. `#476 <https://github.com/pybind/pybind11/pull/476>`_,
  1072. `#479 <https://github.com/pybind/pybind11/pull/479>`_,
  1073. `#499 <https://github.com/pybind/pybind11/pull/499>`_, and
  1074. `#501 <https://github.com/pybind/pybind11/pull/501>`_.
  1075. * ``stl_bind.h``: general improvements and support for ``std::map`` and
  1076. ``std::unordered_map``.
  1077. `#490 <https://github.com/pybind/pybind11/pull/490>`_,
  1078. `#282 <https://github.com/pybind/pybind11/pull/282>`_,
  1079. `#235 <https://github.com/pybind/pybind11/pull/235>`_.
  1080. * The ``std::tuple``, ``std::pair``, ``std::list``, and ``std::vector`` type
  1081. casters now accept any Python sequence type as input. `rev. 107285
  1082. <https://github.com/pybind/pybind11/commit/107285>`_.
  1083. * Improved CMake Python detection on multi-architecture Linux.
  1084. `#532 <https://github.com/pybind/pybind11/pull/532>`_.
  1085. * Infrastructure to selectively disable or enable parts of the automatically
  1086. generated docstrings. `#486 <https://github.com/pybind/pybind11/pull/486>`_.
  1087. * ``reference`` and ``reference_internal`` are now the default return value
  1088. properties for static and non-static properties, respectively. `#473
  1089. <https://github.com/pybind/pybind11/pull/473>`_. (the previous defaults
  1090. were ``automatic``). `#473 <https://github.com/pybind/pybind11/pull/473>`_.
  1091. * Support for ``std::unique_ptr`` with non-default deleters or no deleter at
  1092. all (``py::nodelete``). `#384 <https://github.com/pybind/pybind11/pull/384>`_.
  1093. * Deprecated ``handle::call()`` method. The new syntax to call Python
  1094. functions is simply ``handle()``. It can also be invoked explicitly via
  1095. ``handle::operator<X>()``, where ``X`` is an optional return value policy.
  1096. * Print more informative error messages when ``make_tuple()`` or ``cast()``
  1097. fail. `#262 <https://github.com/pybind/pybind11/pull/262>`_.
  1098. * Creation of holder types for classes deriving from
  1099. ``std::enable_shared_from_this<>`` now also works for ``const`` values.
  1100. `#260 <https://github.com/pybind/pybind11/pull/260>`_.
  1101. * ``make_iterator()`` improvements for better compatibility with various
  1102. types (now uses prefix increment operator); it now also accepts iterators
  1103. with different begin/end types as long as they are equality comparable.
  1104. `#247 <https://github.com/pybind/pybind11/pull/247>`_.
  1105. * ``arg()`` now accepts a wider range of argument types for default values.
  1106. `#244 <https://github.com/pybind/pybind11/pull/244>`_.
  1107. * Support ``keep_alive`` where the nurse object may be ``None``. `#341
  1108. <https://github.com/pybind/pybind11/pull/341>`_.
  1109. * Added constructors for ``str`` and ``bytes`` from zero-terminated char
  1110. pointers, and from char pointers and length. Added constructors for ``str``
  1111. from ``bytes`` and for ``bytes`` from ``str``, which will perform UTF-8
  1112. decoding/encoding as required.
  1113. * Many other improvements of library internals without user-visible changes
  1114. 1.8.1 (July 12, 2016)
  1115. ----------------------
  1116. * Fixed a rare but potentially very severe issue when the garbage collector ran
  1117. during pybind11 type creation.
  1118. 1.8.0 (June 14, 2016)
  1119. ----------------------
  1120. * Redesigned CMake build system which exports a convenient
  1121. ``pybind11_add_module`` function to parent projects.
  1122. * ``std::vector<>`` type bindings analogous to Boost.Python's ``indexing_suite``
  1123. * Transparent conversion of sparse and dense Eigen matrices and vectors (``eigen.h``)
  1124. * Added an ``ExtraFlags`` template argument to the NumPy ``array_t<>`` wrapper
  1125. to disable an enforced cast that may lose precision, e.g. to create overloads
  1126. for different precisions and complex vs real-valued matrices.
  1127. * Prevent implicit conversion of floating point values to integral types in
  1128. function arguments
  1129. * Fixed incorrect default return value policy for functions returning a shared
  1130. pointer
  1131. * Don't allow registering a type via ``class_`` twice
  1132. * Don't allow casting a ``None`` value into a C++ lvalue reference
  1133. * Fixed a crash in ``enum_::operator==`` that was triggered by the ``help()`` command
  1134. * Improved detection of whether or not custom C++ types can be copy/move-constructed
  1135. * Extended ``str`` type to also work with ``bytes`` instances
  1136. * Added a ``"name"_a`` user defined string literal that is equivalent to ``py::arg("name")``.
  1137. * When specifying function arguments via ``py::arg``, the test that verifies
  1138. the number of arguments now runs at compile time.
  1139. * Added ``[[noreturn]]`` attribute to ``pybind11_fail()`` to quench some
  1140. compiler warnings
  1141. * List function arguments in exception text when the dispatch code cannot find
  1142. a matching overload
  1143. * Added ``PYBIND11_OVERLOAD_NAME`` and ``PYBIND11_OVERLOAD_PURE_NAME`` macros which
  1144. can be used to override virtual methods whose name differs in C++ and Python
  1145. (e.g. ``__call__`` and ``operator()``)
  1146. * Various minor ``iterator`` and ``make_iterator()`` improvements
  1147. * Transparently support ``__bool__`` on Python 2.x and Python 3.x
  1148. * Fixed issue with destructor of unpickled object not being called
  1149. * Minor CMake build system improvements on Windows
  1150. * New ``pybind11::args`` and ``pybind11::kwargs`` types to create functions which
  1151. take an arbitrary number of arguments and keyword arguments
  1152. * New syntax to call a Python function from C++ using ``*args`` and ``*kwargs``
  1153. * The functions ``def_property_*`` now correctly process docstring arguments (these
  1154. formerly caused a segmentation fault)
  1155. * Many ``mkdoc.py`` improvements (enumerations, template arguments, ``DOC()``
  1156. macro accepts more arguments)
  1157. * Cygwin support
  1158. * Documentation improvements (pickling support, ``keep_alive``, macro usage)
  1159. 1.7 (April 30, 2016)
  1160. ----------------------
  1161. * Added a new ``move`` return value policy that triggers C++11 move semantics.
  1162. The automatic return value policy falls back to this case whenever a rvalue
  1163. reference is encountered
  1164. * Significantly more general GIL state routines that are used instead of
  1165. Python's troublesome ``PyGILState_Ensure`` and ``PyGILState_Release`` API
  1166. * Redesign of opaque types that drastically simplifies their usage
  1167. * Extended ability to pass values of type ``[const] void *``
  1168. * ``keep_alive`` fix: don't fail when there is no patient
  1169. * ``functional.h``: acquire the GIL before calling a Python function
  1170. * Added Python RAII type wrappers ``none`` and ``iterable``
  1171. * Added ``*args`` and ``*kwargs`` pass-through parameters to
  1172. ``pybind11.get_include()`` function
  1173. * Iterator improvements and fixes
  1174. * Documentation on return value policies and opaque types improved
  1175. 1.6 (April 30, 2016)
  1176. ----------------------
  1177. * Skipped due to upload to PyPI gone wrong and inability to recover
  1178. (https://github.com/pypa/packaging-problems/issues/74)
  1179. 1.5 (April 21, 2016)
  1180. ----------------------
  1181. * For polymorphic types, use RTTI to try to return the closest type registered with pybind11
  1182. * Pickling support for serializing and unserializing C++ instances to a byte stream in Python
  1183. * Added a convenience routine ``make_iterator()`` which turns a range indicated
  1184. by a pair of C++ iterators into a iterable Python object
  1185. * Added ``len()`` and a variadic ``make_tuple()`` function
  1186. * Addressed a rare issue that could confuse the current virtual function
  1187. dispatcher and another that could lead to crashes in multi-threaded
  1188. applications
  1189. * Added a ``get_include()`` function to the Python module that returns the path
  1190. of the directory containing the installed pybind11 header files
  1191. * Documentation improvements: import issues, symbol visibility, pickling, limitations
  1192. * Added casting support for ``std::reference_wrapper<>``
  1193. 1.4 (April 7, 2016)
  1194. --------------------------
  1195. * Transparent type conversion for ``std::wstring`` and ``wchar_t``
  1196. * Allow passing ``nullptr``-valued strings
  1197. * Transparent passing of ``void *`` pointers using capsules
  1198. * Transparent support for returning values wrapped in ``std::unique_ptr<>``
  1199. * Improved docstring generation for compatibility with Sphinx
  1200. * Nicer debug error message when default parameter construction fails
  1201. * Support for "opaque" types that bypass the transparent conversion layer for STL containers
  1202. * Redesigned type casting interface to avoid ambiguities that could occasionally cause compiler errors
  1203. * Redesigned property implementation; fixes crashes due to an unfortunate default return value policy
  1204. * Anaconda package generation support
  1205. 1.3 (March 8, 2016)
  1206. --------------------------
  1207. * Added support for the Intel C++ compiler (v15+)
  1208. * Added support for the STL unordered set/map data structures
  1209. * Added support for the STL linked list data structure
  1210. * NumPy-style broadcasting support in ``pybind11::vectorize``
  1211. * pybind11 now displays more verbose error messages when ``arg::operator=()`` fails
  1212. * pybind11 internal data structures now live in a version-dependent namespace to avoid ABI issues
  1213. * Many, many bugfixes involving corner cases and advanced usage
  1214. 1.2 (February 7, 2016)
  1215. --------------------------
  1216. * Optional: efficient generation of function signatures at compile time using C++14
  1217. * Switched to a simpler and more general way of dealing with function default
  1218. arguments. Unused keyword arguments in function calls are now detected and
  1219. cause errors as expected
  1220. * New ``keep_alive`` call policy analogous to Boost.Python's ``with_custodian_and_ward``
  1221. * New ``pybind11::base<>`` attribute to indicate a subclass relationship
  1222. * Improved interface for RAII type wrappers in ``pytypes.h``
  1223. * Use RAII type wrappers consistently within pybind11 itself. This
  1224. fixes various potential refcount leaks when exceptions occur
  1225. * Added new ``bytes`` RAII type wrapper (maps to ``string`` in Python 2.7)
  1226. * Made handle and related RAII classes const correct, using them more
  1227. consistently everywhere now
  1228. * Got rid of the ugly ``__pybind11__`` attributes on the Python side---they are
  1229. now stored in a C++ hash table that is not visible in Python
  1230. * Fixed refcount leaks involving NumPy arrays and bound functions
  1231. * Vastly improved handling of shared/smart pointers
  1232. * Removed an unnecessary copy operation in ``pybind11::vectorize``
  1233. * Fixed naming clashes when both pybind11 and NumPy headers are included
  1234. * Added conversions for additional exception types
  1235. * Documentation improvements (using multiple extension modules, smart pointers,
  1236. other minor clarifications)
  1237. * unified infrastructure for parsing variadic arguments in ``class_`` and cpp_function
  1238. * Fixed license text (was: ZLIB, should have been: 3-clause BSD)
  1239. * Python 3.2 compatibility
  1240. * Fixed remaining issues when accessing types in another plugin module
  1241. * Added enum comparison and casting methods
  1242. * Improved SFINAE-based detection of whether types are copy-constructible
  1243. * Eliminated many warnings about unused variables and the use of ``offsetof()``
  1244. * Support for ``std::array<>`` conversions
  1245. 1.1 (December 7, 2015)
  1246. --------------------------
  1247. * Documentation improvements (GIL, wrapping functions, casting, fixed many typos)
  1248. * Generalized conversion of integer types
  1249. * Improved support for casting function objects
  1250. * Improved support for ``std::shared_ptr<>`` conversions
  1251. * Initial support for ``std::set<>`` conversions
  1252. * Fixed type resolution issue for types defined in a separate plugin module
  1253. * CMake build system improvements
  1254. * Factored out generic functionality to non-templated code (smaller code size)
  1255. * Added a code size / compile time benchmark vs Boost.Python
  1256. * Added an appveyor CI script
  1257. 1.0 (October 15, 2015)
  1258. ------------------------
  1259. * Initial release