changelog.rst revision 12391
1.. _changelog: 2 3Changelog 4######### 5 6Starting with version 1.8.0, pybind11 releases use a `semantic versioning 7<http://semver.org>`_ policy. 8 9v2.3.0 (Not yet released) 10----------------------------------------------------- 11 12* TBD 13 14v2.2.1 (September 14, 2017) 15----------------------------------------------------- 16 17* Added ``py::module::reload()`` member function for reloading a module. 18 `#1040 <https://github.com/pybind/pybind11/pull/1040>`_. 19 20* Fixed a reference leak in the number converter. 21 `#1078 <https://github.com/pybind/pybind11/pull/1078>`_. 22 23* Fixed compilation with Clang on host GCC < 5 (old libstdc++ which isn't fully 24 C++11 compliant). `#1062 <https://github.com/pybind/pybind11/pull/1062>`_. 25 26* Fixed a regression where the automatic ``std::vector<bool>`` caster would 27 fail to compile. The same fix also applies to any container which returns 28 element proxies instead of references. 29 `#1053 <https://github.com/pybind/pybind11/pull/1053>`_. 30 31* Fixed a regression where the ``py::keep_alive`` policy could not be applied 32 to constructors. `#1065 <https://github.com/pybind/pybind11/pull/1065>`_. 33 34* Fixed a nullptr dereference when loading a ``py::module_local`` type 35 that's only registered in an external module. 36 `#1058 <https://github.com/pybind/pybind11/pull/1058>`_. 37 38* Fixed implicit conversion of accessors to types derived from ``py::object``. 39 `#1076 <https://github.com/pybind/pybind11/pull/1076>`_. 40 41* The ``name`` in ``PYBIND11_MODULE(name, variable)`` can now be a macro. 42 `#1082 <https://github.com/pybind/pybind11/pull/1082>`_. 43 44* Relaxed overly strict ``py::pickle()`` check for matching get and set types. 45 `#1064 <https://github.com/pybind/pybind11/pull/1064>`_. 46 47* Conversion errors now try to be more informative when it's likely that 48 a missing header is the cause (e.g. forgetting ``<pybind11/stl.h>``). 49 `#1077 <https://github.com/pybind/pybind11/pull/1077>`_. 50 51v2.2.0 (August 31, 2017) 52----------------------------------------------------- 53 54* Support for embedding the Python interpreter. See the 55 :doc:`documentation page </advanced/embedding>` for a 56 full overview of the new features. 57 `#774 <https://github.com/pybind/pybind11/pull/774>`_, 58 `#889 <https://github.com/pybind/pybind11/pull/889>`_, 59 `#892 <https://github.com/pybind/pybind11/pull/892>`_, 60 `#920 <https://github.com/pybind/pybind11/pull/920>`_. 61 62 .. code-block:: cpp 63 64 #include <pybind11/embed.h> 65 namespace py = pybind11; 66 67 int main() { 68 py::scoped_interpreter guard{}; // start the interpreter and keep it alive 69 70 py::print("Hello, World!"); // use the Python API 71 } 72 73* Support for inheriting from multiple C++ bases in Python. 74 `#693 <https://github.com/pybind/pybind11/pull/693>`_. 75 76 .. code-block:: python 77 78 from cpp_module import CppBase1, CppBase2 79 80 class PyDerived(CppBase1, CppBase2): 81 def __init__(self): 82 CppBase1.__init__(self) # C++ bases must be initialized explicitly 83 CppBase2.__init__(self) 84 85* ``PYBIND11_MODULE`` is now the preferred way to create module entry points. 86 ``PYBIND11_PLUGIN`` is deprecated. See :ref:`macros` for details. 87 `#879 <https://github.com/pybind/pybind11/pull/879>`_. 88 89 .. code-block:: cpp 90 91 // new 92 PYBIND11_MODULE(example, m) { 93 m.def("add", [](int a, int b) { return a + b; }); 94 } 95 96 // old 97 PYBIND11_PLUGIN(example) { 98 py::module m("example"); 99 m.def("add", [](int a, int b) { return a + b; }); 100 return m.ptr(); 101 } 102 103* pybind11's headers and build system now more strictly enforce hidden symbol 104 visibility for extension modules. This should be seamless for most users, 105 but see the :doc:`upgrade` if you use a custom build system. 106 `#995 <https://github.com/pybind/pybind11/pull/995>`_. 107 108* Support for ``py::module_local`` types which allow multiple modules to 109 export the same C++ types without conflicts. This is useful for opaque 110 types like ``std::vector<int>``. ``py::bind_vector`` and ``py::bind_map`` 111 now default to ``py::module_local`` if their elements are builtins or 112 local types. See :ref:`module_local` for details. 113 `#949 <https://github.com/pybind/pybind11/pull/949>`_, 114 `#981 <https://github.com/pybind/pybind11/pull/981>`_, 115 `#995 <https://github.com/pybind/pybind11/pull/995>`_, 116 `#997 <https://github.com/pybind/pybind11/pull/997>`_. 117 118* Custom constructors can now be added very easily using lambdas or factory 119 functions which return a class instance by value, pointer or holder. This 120 supersedes the old placement-new ``__init__`` technique. 121 See :ref:`custom_constructors` for details. 122 `#805 <https://github.com/pybind/pybind11/pull/805>`_, 123 `#1014 <https://github.com/pybind/pybind11/pull/1014>`_. 124 125 .. code-block:: cpp 126 127 struct Example { 128 Example(std::string); 129 }; 130 131 py::class_<Example>(m, "Example") 132 .def(py::init<std::string>()) // existing constructor 133 .def(py::init([](int n) { // custom constructor 134 return std::make_unique<Example>(std::to_string(n)); 135 })); 136 137* Similarly to custom constructors, pickling support functions are now bound 138 using the ``py::pickle()`` adaptor which improves type safety. See the 139 :doc:`upgrade` and :ref:`pickling` for details. 140 `#1038 <https://github.com/pybind/pybind11/pull/1038>`_. 141 142* Builtin support for converting C++17 standard library types and general 143 conversion improvements: 144 145 1. C++17 ``std::variant`` is supported right out of the box. C++11/14 146 equivalents (e.g. ``boost::variant``) can also be added with a simple 147 user-defined specialization. See :ref:`cpp17_container_casters` for details. 148 `#811 <https://github.com/pybind/pybind11/pull/811>`_, 149 `#845 <https://github.com/pybind/pybind11/pull/845>`_, 150 `#989 <https://github.com/pybind/pybind11/pull/989>`_. 151 152 2. Out-of-the-box support for C++17 ``std::string_view``. 153 `#906 <https://github.com/pybind/pybind11/pull/906>`_. 154 155 3. Improved compatibility of the builtin ``optional`` converter. 156 `#874 <https://github.com/pybind/pybind11/pull/874>`_. 157 158 4. The ``bool`` converter now accepts ``numpy.bool_`` and types which 159 define ``__bool__`` (Python 3.x) or ``__nonzero__`` (Python 2.7). 160 `#925 <https://github.com/pybind/pybind11/pull/925>`_. 161 162 5. C++-to-Python casters are now more efficient and move elements out 163 of rvalue containers whenever possible. 164 `#851 <https://github.com/pybind/pybind11/pull/851>`_, 165 `#936 <https://github.com/pybind/pybind11/pull/936>`_, 166 `#938 <https://github.com/pybind/pybind11/pull/938>`_. 167 168 6. Fixed ``bytes`` to ``std::string/char*`` conversion on Python 3. 169 `#817 <https://github.com/pybind/pybind11/pull/817>`_. 170 171 7. Fixed lifetime of temporary C++ objects created in Python-to-C++ conversions. 172 `#924 <https://github.com/pybind/pybind11/pull/924>`_. 173 174* Scope guard call policy for RAII types, e.g. ``py::call_guard<py::gil_scoped_release>()``, 175 ``py::call_guard<py::scoped_ostream_redirect>()``. See :ref:`call_policies` for details. 176 `#740 <https://github.com/pybind/pybind11/pull/740>`_. 177 178* Utility for redirecting C++ streams to Python (e.g. ``std::cout`` -> 179 ``sys.stdout``). Scope guard ``py::scoped_ostream_redirect`` in C++ and 180 a context manager in Python. See :ref:`ostream_redirect`. 181 `#1009 <https://github.com/pybind/pybind11/pull/1009>`_. 182 183* Improved handling of types and exceptions across module boundaries. 184 `#915 <https://github.com/pybind/pybind11/pull/915>`_, 185 `#951 <https://github.com/pybind/pybind11/pull/951>`_, 186 `#995 <https://github.com/pybind/pybind11/pull/995>`_. 187 188* Fixed destruction order of ``py::keep_alive`` nurse/patient objects 189 in reference cycles. 190 `#856 <https://github.com/pybind/pybind11/pull/856>`_. 191 192* Numpy and buffer protocol related improvements: 193 194 1. Support for negative strides in Python buffer objects/numpy arrays. This 195 required changing integers from unsigned to signed for the related C++ APIs. 196 Note: If you have compiler warnings enabled, you may notice some new conversion 197 warnings after upgrading. These can be resolved with ``static_cast``. 198 `#782 <https://github.com/pybind/pybind11/pull/782>`_. 199 200 2. Support ``std::complex`` and arrays inside ``PYBIND11_NUMPY_DTYPE``. 201 `#831 <https://github.com/pybind/pybind11/pull/831>`_, 202 `#832 <https://github.com/pybind/pybind11/pull/832>`_. 203 204 3. Support for constructing ``py::buffer_info`` and ``py::arrays`` using 205 arbitrary containers or iterators instead of requiring a ``std::vector``. 206 `#788 <https://github.com/pybind/pybind11/pull/788>`_, 207 `#822 <https://github.com/pybind/pybind11/pull/822>`_, 208 `#860 <https://github.com/pybind/pybind11/pull/860>`_. 209 210 4. Explicitly check numpy version and require >= 1.7.0. 211 `#819 <https://github.com/pybind/pybind11/pull/819>`_. 212 213* Support for allowing/prohibiting ``None`` for specific arguments and improved 214 ``None`` overload resolution order. See :ref:`none_arguments` for details. 215 `#843 <https://github.com/pybind/pybind11/pull/843>`_. 216 `#859 <https://github.com/pybind/pybind11/pull/859>`_. 217 218* Added ``py::exec()`` as a shortcut for ``py::eval<py::eval_statements>()`` 219 and support for C++11 raw string literals as input. See :ref:`eval`. 220 `#766 <https://github.com/pybind/pybind11/pull/766>`_, 221 `#827 <https://github.com/pybind/pybind11/pull/827>`_. 222 223* ``py::vectorize()`` ignores non-vectorizable arguments and supports 224 member functions. 225 `#762 <https://github.com/pybind/pybind11/pull/762>`_. 226 227* Support for bound methods as callbacks (``pybind11/functional.h``). 228 `#815 <https://github.com/pybind/pybind11/pull/815>`_. 229 230* Allow aliasing pybind11 methods: ``cls.attr("foo") = cls.attr("bar")``. 231 `#802 <https://github.com/pybind/pybind11/pull/802>`_. 232 233* Don't allow mixed static/non-static overloads. 234 `#804 <https://github.com/pybind/pybind11/pull/804>`_. 235 236* Fixed overriding static properties in derived classes. 237 `#784 <https://github.com/pybind/pybind11/pull/784>`_. 238 239* Improved deduction of member functions of a derived class when its bases 240 aren't registered with pybind11. 241 `#855 <https://github.com/pybind/pybind11/pull/855>`_. 242 243 .. code-block:: cpp 244 245 struct Base { 246 int foo() { return 42; } 247 } 248 249 struct Derived : Base {} 250 251 // Now works, but previously required also binding `Base` 252 py::class_<Derived>(m, "Derived") 253 .def("foo", &Derived::foo); // function is actually from `Base` 254 255* The implementation of ``py::init<>`` now uses C++11 brace initialization 256 syntax to construct instances, which permits binding implicit constructors of 257 aggregate types. `#1015 <https://github.com/pybind/pybind11/pull/1015>`_. 258 259 .. code-block:: cpp 260 261 struct Aggregate { 262 int a; 263 std::string b; 264 }; 265 266 py::class_<Aggregate>(m, "Aggregate") 267 .def(py::init<int, const std::string &>()); 268 269* Fixed issues with multiple inheritance with offset base/derived pointers. 270 `#812 <https://github.com/pybind/pybind11/pull/812>`_, 271 `#866 <https://github.com/pybind/pybind11/pull/866>`_, 272 `#960 <https://github.com/pybind/pybind11/pull/960>`_. 273 274* Fixed reference leak of type objects. 275 `#1030 <https://github.com/pybind/pybind11/pull/1030>`_. 276 277* Improved support for the ``/std:c++14`` and ``/std:c++latest`` modes 278 on MSVC 2017. 279 `#841 <https://github.com/pybind/pybind11/pull/841>`_, 280 `#999 <https://github.com/pybind/pybind11/pull/999>`_. 281 282* Fixed detection of private operator new on MSVC. 283 `#893 <https://github.com/pybind/pybind11/pull/893>`_, 284 `#918 <https://github.com/pybind/pybind11/pull/918>`_. 285 286* Intel C++ compiler compatibility fixes. 287 `#937 <https://github.com/pybind/pybind11/pull/937>`_. 288 289* Fixed implicit conversion of `py::enum_` to integer types on Python 2.7. 290 `#821 <https://github.com/pybind/pybind11/pull/821>`_. 291 292* Added ``py::hash`` to fetch the hash value of Python objects, and 293 ``.def(hash(py::self))`` to provide the C++ ``std::hash`` as the Python 294 ``__hash__`` method. 295 `#1034 <https://github.com/pybind/pybind11/pull/1034>`_. 296 297* Fixed ``__truediv__`` on Python 2 and ``__itruediv__`` on Python 3. 298 `#867 <https://github.com/pybind/pybind11/pull/867>`_. 299 300* ``py::capsule`` objects now support the ``name`` attribute. This is useful 301 for interfacing with ``scipy.LowLevelCallable``. 302 `#902 <https://github.com/pybind/pybind11/pull/902>`_. 303 304* Fixed ``py::make_iterator``'s ``__next__()`` for past-the-end calls. 305 `#897 <https://github.com/pybind/pybind11/pull/897>`_. 306 307* Added ``error_already_set::matches()`` for checking Python exceptions. 308 `#772 <https://github.com/pybind/pybind11/pull/772>`_. 309 310* Deprecated ``py::error_already_set::clear()``. It's no longer needed 311 following a simplification of the ``py::error_already_set`` class. 312 `#954 <https://github.com/pybind/pybind11/pull/954>`_. 313 314* Deprecated ``py::handle::operator==()`` in favor of ``py::handle::is()`` 315 `#825 <https://github.com/pybind/pybind11/pull/825>`_. 316 317* Deprecated ``py::object::borrowed``/``py::object::stolen``. 318 Use ``py::object::borrowed_t{}``/``py::object::stolen_t{}`` instead. 319 `#771 <https://github.com/pybind/pybind11/pull/771>`_. 320 321* Changed internal data structure versioning to avoid conflicts between 322 modules compiled with different revisions of pybind11. 323 `#1012 <https://github.com/pybind/pybind11/pull/1012>`_. 324 325* Additional compile-time and run-time error checking and more informative messages. 326 `#786 <https://github.com/pybind/pybind11/pull/786>`_, 327 `#794 <https://github.com/pybind/pybind11/pull/794>`_, 328 `#803 <https://github.com/pybind/pybind11/pull/803>`_. 329 330* Various minor improvements and fixes. 331 `#764 <https://github.com/pybind/pybind11/pull/764>`_, 332 `#791 <https://github.com/pybind/pybind11/pull/791>`_, 333 `#795 <https://github.com/pybind/pybind11/pull/795>`_, 334 `#840 <https://github.com/pybind/pybind11/pull/840>`_, 335 `#844 <https://github.com/pybind/pybind11/pull/844>`_, 336 `#846 <https://github.com/pybind/pybind11/pull/846>`_, 337 `#849 <https://github.com/pybind/pybind11/pull/849>`_, 338 `#858 <https://github.com/pybind/pybind11/pull/858>`_, 339 `#862 <https://github.com/pybind/pybind11/pull/862>`_, 340 `#871 <https://github.com/pybind/pybind11/pull/871>`_, 341 `#872 <https://github.com/pybind/pybind11/pull/872>`_, 342 `#881 <https://github.com/pybind/pybind11/pull/881>`_, 343 `#888 <https://github.com/pybind/pybind11/pull/888>`_, 344 `#899 <https://github.com/pybind/pybind11/pull/899>`_, 345 `#928 <https://github.com/pybind/pybind11/pull/928>`_, 346 `#931 <https://github.com/pybind/pybind11/pull/931>`_, 347 `#944 <https://github.com/pybind/pybind11/pull/944>`_, 348 `#950 <https://github.com/pybind/pybind11/pull/950>`_, 349 `#952 <https://github.com/pybind/pybind11/pull/952>`_, 350 `#962 <https://github.com/pybind/pybind11/pull/962>`_, 351 `#965 <https://github.com/pybind/pybind11/pull/965>`_, 352 `#970 <https://github.com/pybind/pybind11/pull/970>`_, 353 `#978 <https://github.com/pybind/pybind11/pull/978>`_, 354 `#979 <https://github.com/pybind/pybind11/pull/979>`_, 355 `#986 <https://github.com/pybind/pybind11/pull/986>`_, 356 `#1020 <https://github.com/pybind/pybind11/pull/1020>`_, 357 `#1027 <https://github.com/pybind/pybind11/pull/1027>`_, 358 `#1037 <https://github.com/pybind/pybind11/pull/1037>`_. 359 360* Testing improvements. 361 `#798 <https://github.com/pybind/pybind11/pull/798>`_, 362 `#882 <https://github.com/pybind/pybind11/pull/882>`_, 363 `#898 <https://github.com/pybind/pybind11/pull/898>`_, 364 `#900 <https://github.com/pybind/pybind11/pull/900>`_, 365 `#921 <https://github.com/pybind/pybind11/pull/921>`_, 366 `#923 <https://github.com/pybind/pybind11/pull/923>`_, 367 `#963 <https://github.com/pybind/pybind11/pull/963>`_. 368 369v2.1.1 (April 7, 2017) 370----------------------------------------------------- 371 372* Fixed minimum version requirement for MSVC 2015u3 373 `#773 <https://github.com/pybind/pybind11/pull/773>`_. 374 375v2.1.0 (March 22, 2017) 376----------------------------------------------------- 377 378* pybind11 now performs function overload resolution in two phases. The first 379 phase only considers exact type matches, while the second allows for implicit 380 conversions to take place. A special ``noconvert()`` syntax can be used to 381 completely disable implicit conversions for specific arguments. 382 `#643 <https://github.com/pybind/pybind11/pull/643>`_, 383 `#634 <https://github.com/pybind/pybind11/pull/634>`_, 384 `#650 <https://github.com/pybind/pybind11/pull/650>`_. 385 386* Fixed a regression where static properties no longer worked with classes 387 using multiple inheritance. The ``py::metaclass`` attribute is no longer 388 necessary (and deprecated as of this release) when binding classes with 389 static properties. 390 `#679 <https://github.com/pybind/pybind11/pull/679>`_, 391 392* Classes bound using ``pybind11`` can now use custom metaclasses. 393 `#679 <https://github.com/pybind/pybind11/pull/679>`_, 394 395* ``py::args`` and ``py::kwargs`` can now be mixed with other positional 396 arguments when binding functions using pybind11. 397 `#611 <https://github.com/pybind/pybind11/pull/611>`_. 398 399* Improved support for C++11 unicode string and character types; added 400 extensive documentation regarding pybind11's string conversion behavior. 401 `#624 <https://github.com/pybind/pybind11/pull/624>`_, 402 `#636 <https://github.com/pybind/pybind11/pull/636>`_, 403 `#715 <https://github.com/pybind/pybind11/pull/715>`_. 404 405* pybind11 can now avoid expensive copies when converting Eigen arrays to NumPy 406 arrays (and vice versa). `#610 <https://github.com/pybind/pybind11/pull/610>`_. 407 408* The "fast path" in ``py::vectorize`` now works for any full-size group of C or 409 F-contiguous arrays. The non-fast path is also faster since it no longer performs 410 copies of the input arguments (except when type conversions are necessary). 411 `#610 <https://github.com/pybind/pybind11/pull/610>`_. 412 413* Added fast, unchecked access to NumPy arrays via a proxy object. 414 `#746 <https://github.com/pybind/pybind11/pull/746>`_. 415 416* Transparent support for class-specific ``operator new`` and 417 ``operator delete`` implementations. 418 `#755 <https://github.com/pybind/pybind11/pull/755>`_. 419 420* Slimmer and more efficient STL-compatible iterator interface for sequence types. 421 `#662 <https://github.com/pybind/pybind11/pull/662>`_. 422 423* Improved custom holder type support. 424 `#607 <https://github.com/pybind/pybind11/pull/607>`_. 425 426* ``nullptr`` to ``None`` conversion fixed in various builtin type casters. 427 `#732 <https://github.com/pybind/pybind11/pull/732>`_. 428 429* ``enum_`` now exposes its members via a special ``__members__`` attribute. 430 `#666 <https://github.com/pybind/pybind11/pull/666>`_. 431 432* ``std::vector`` bindings created using ``stl_bind.h`` can now optionally 433 implement the buffer protocol. `#488 <https://github.com/pybind/pybind11/pull/488>`_. 434 435* Automated C++ reference documentation using doxygen and breathe. 436 `#598 <https://github.com/pybind/pybind11/pull/598>`_. 437 438* Added minimum compiler version assertions. 439 `#727 <https://github.com/pybind/pybind11/pull/727>`_. 440 441* Improved compatibility with C++1z. 442 `#677 <https://github.com/pybind/pybind11/pull/677>`_. 443 444* Improved ``py::capsule`` API. Can be used to implement cleanup 445 callbacks that are involved at module destruction time. 446 `#752 <https://github.com/pybind/pybind11/pull/752>`_. 447 448* Various minor improvements and fixes. 449 `#595 <https://github.com/pybind/pybind11/pull/595>`_, 450 `#588 <https://github.com/pybind/pybind11/pull/588>`_, 451 `#589 <https://github.com/pybind/pybind11/pull/589>`_, 452 `#603 <https://github.com/pybind/pybind11/pull/603>`_, 453 `#619 <https://github.com/pybind/pybind11/pull/619>`_, 454 `#648 <https://github.com/pybind/pybind11/pull/648>`_, 455 `#695 <https://github.com/pybind/pybind11/pull/695>`_, 456 `#720 <https://github.com/pybind/pybind11/pull/720>`_, 457 `#723 <https://github.com/pybind/pybind11/pull/723>`_, 458 `#729 <https://github.com/pybind/pybind11/pull/729>`_, 459 `#724 <https://github.com/pybind/pybind11/pull/724>`_, 460 `#742 <https://github.com/pybind/pybind11/pull/742>`_, 461 `#753 <https://github.com/pybind/pybind11/pull/753>`_. 462 463v2.0.1 (Jan 4, 2017) 464----------------------------------------------------- 465 466* Fix pointer to reference error in type_caster on MSVC 467 `#583 <https://github.com/pybind/pybind11/pull/583>`_. 468 469* Fixed a segmentation in the test suite due to a typo 470 `cd7eac <https://github.com/pybind/pybind11/commit/cd7eac>`_. 471 472v2.0.0 (Jan 1, 2017) 473----------------------------------------------------- 474 475* Fixed a reference counting regression affecting types with custom metaclasses 476 (introduced in v2.0.0-rc1). 477 `#571 <https://github.com/pybind/pybind11/pull/571>`_. 478 479* Quenched a CMake policy warning. 480 `#570 <https://github.com/pybind/pybind11/pull/570>`_. 481 482v2.0.0-rc1 (Dec 23, 2016) 483----------------------------------------------------- 484 485The pybind11 developers are excited to issue a release candidate of pybind11 486with a subsequent v2.0.0 release planned in early January next year. 487 488An incredible amount of effort by went into pybind11 over the last ~5 months, 489leading to a release that is jam-packed with exciting new features and numerous 490usability improvements. The following list links PRs or individual commits 491whenever applicable. 492 493Happy Christmas! 494 495* Support for binding C++ class hierarchies that make use of multiple 496 inheritance. `#410 <https://github.com/pybind/pybind11/pull/410>`_. 497 498* PyPy support: pybind11 now supports nightly builds of PyPy and will 499 interoperate with the future 5.7 release. No code changes are necessary, 500 everything "just" works as usual. Note that we only target the Python 2.7 501 branch for now; support for 3.x will be added once its ``cpyext`` extension 502 support catches up. A few minor features remain unsupported for the time 503 being (notably dynamic attributes in custom types). 504 `#527 <https://github.com/pybind/pybind11/pull/527>`_. 505 506* Significant work on the documentation -- in particular, the monolitic 507 ``advanced.rst`` file was restructured into a easier to read hierarchical 508 organization. `#448 <https://github.com/pybind/pybind11/pull/448>`_. 509 510* Many NumPy-related improvements: 511 512 1. Object-oriented API to access and modify NumPy ``ndarray`` instances, 513 replicating much of the corresponding NumPy C API functionality. 514 `#402 <https://github.com/pybind/pybind11/pull/402>`_. 515 516 2. NumPy array ``dtype`` array descriptors are now first-class citizens and 517 are exposed via a new class ``py::dtype``. 518 519 3. Structured dtypes can be registered using the ``PYBIND11_NUMPY_DTYPE()`` 520 macro. Special ``array`` constructors accepting dtype objects were also 521 added. 522 523 One potential caveat involving this change: format descriptor strings 524 should now be accessed via ``format_descriptor::format()`` (however, for 525 compatibility purposes, the old syntax ``format_descriptor::value`` will 526 still work for non-structured data types). `#308 527 <https://github.com/pybind/pybind11/pull/308>`_. 528 529 4. Further improvements to support structured dtypes throughout the system. 530 `#472 <https://github.com/pybind/pybind11/pull/472>`_, 531 `#474 <https://github.com/pybind/pybind11/pull/474>`_, 532 `#459 <https://github.com/pybind/pybind11/pull/459>`_, 533 `#453 <https://github.com/pybind/pybind11/pull/453>`_, 534 `#452 <https://github.com/pybind/pybind11/pull/452>`_, and 535 `#505 <https://github.com/pybind/pybind11/pull/505>`_. 536 537 5. Fast access operators. `#497 <https://github.com/pybind/pybind11/pull/497>`_. 538 539 6. Constructors for arrays whose storage is owned by another object. 540 `#440 <https://github.com/pybind/pybind11/pull/440>`_. 541 542 7. Added constructors for ``array`` and ``array_t`` explicitly accepting shape 543 and strides; if strides are not provided, they are deduced assuming 544 C-contiguity. Also added simplified constructors for 1-dimensional case. 545 546 8. Added buffer/NumPy support for ``char[N]`` and ``std::array<char, N>`` types. 547 548 9. Added ``memoryview`` wrapper type which is constructible from ``buffer_info``. 549 550* Eigen: many additional conversions and support for non-contiguous 551 arrays/slices. 552 `#427 <https://github.com/pybind/pybind11/pull/427>`_, 553 `#315 <https://github.com/pybind/pybind11/pull/315>`_, 554 `#316 <https://github.com/pybind/pybind11/pull/316>`_, 555 `#312 <https://github.com/pybind/pybind11/pull/312>`_, and 556 `#267 <https://github.com/pybind/pybind11/pull/267>`_ 557 558* Incompatible changes in ``class_<...>::class_()``: 559 560 1. Declarations of types that provide access via the buffer protocol must 561 now include the ``py::buffer_protocol()`` annotation as an argument to 562 the ``class_`` constructor. 563 564 2. Declarations of types that require a custom metaclass (i.e. all classes 565 which include static properties via commands such as 566 ``def_readwrite_static()``) must now include the ``py::metaclass()`` 567 annotation as an argument to the ``class_`` constructor. 568 569 These two changes were necessary to make type definitions in pybind11 570 future-proof, and to support PyPy via its cpyext mechanism. `#527 571 <https://github.com/pybind/pybind11/pull/527>`_. 572 573 574 3. This version of pybind11 uses a redesigned mechnism for instantiating 575 trempoline classes that are used to override virtual methods from within 576 Python. This led to the following user-visible syntax change: instead of 577 578 .. code-block:: cpp 579 580 py::class_<TrampolineClass>("MyClass") 581 .alias<MyClass>() 582 .... 583 584 write 585 586 .. code-block:: cpp 587 588 py::class_<MyClass, TrampolineClass>("MyClass") 589 .... 590 591 Importantly, both the original and the trampoline class are now 592 specified as an arguments (in arbitrary order) to the ``py::class_`` 593 template, and the ``alias<..>()`` call is gone. The new scheme has zero 594 overhead in cases when Python doesn't override any functions of the 595 underlying C++ class. `rev. 86d825 596 <https://github.com/pybind/pybind11/commit/86d825>`_. 597 598* Added ``eval`` and ``eval_file`` functions for evaluating expressions and 599 statements from a string or file. `rev. 0d3fc3 600 <https://github.com/pybind/pybind11/commit/0d3fc3>`_. 601 602* pybind11 can now create types with a modifiable dictionary. 603 `#437 <https://github.com/pybind/pybind11/pull/437>`_ and 604 `#444 <https://github.com/pybind/pybind11/pull/444>`_. 605 606* Support for translation of arbitrary C++ exceptions to Python counterparts. 607 `#296 <https://github.com/pybind/pybind11/pull/296>`_ and 608 `#273 <https://github.com/pybind/pybind11/pull/273>`_. 609 610* Report full backtraces through mixed C++/Python code, better reporting for 611 import errors, fixed GIL management in exception processing. 612 `#537 <https://github.com/pybind/pybind11/pull/537>`_, 613 `#494 <https://github.com/pybind/pybind11/pull/494>`_, 614 `rev. e72d95 <https://github.com/pybind/pybind11/commit/e72d95>`_, and 615 `rev. 099d6e <https://github.com/pybind/pybind11/commit/099d6e>`_. 616 617* Support for bit-level operations, comparisons, and serialization of C++ 618 enumerations. `#503 <https://github.com/pybind/pybind11/pull/503>`_, 619 `#508 <https://github.com/pybind/pybind11/pull/508>`_, 620 `#380 <https://github.com/pybind/pybind11/pull/380>`_, 621 `#309 <https://github.com/pybind/pybind11/pull/309>`_. 622 `#311 <https://github.com/pybind/pybind11/pull/311>`_. 623 624* The ``class_`` constructor now accepts its template arguments in any order. 625 `#385 <https://github.com/pybind/pybind11/pull/385>`_. 626 627* Attribute and item accessors now have a more complete interface which makes 628 it possible to chain attributes as in 629 ``obj.attr("a")[key].attr("b").attr("method")(1, 2, 3)``. `#425 630 <https://github.com/pybind/pybind11/pull/425>`_. 631 632* Major redesign of the default and conversion constructors in ``pytypes.h``. 633 `#464 <https://github.com/pybind/pybind11/pull/464>`_. 634 635* Added built-in support for ``std::shared_ptr`` holder type. It is no longer 636 necessary to to include a declaration of the form 637 ``PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>)`` (though continuing to 638 do so won't cause an error). 639 `#454 <https://github.com/pybind/pybind11/pull/454>`_. 640 641* New ``py::overload_cast`` casting operator to select among multiple possible 642 overloads of a function. An example: 643 644 .. code-block:: cpp 645 646 py::class_<Pet>(m, "Pet") 647 .def("set", py::overload_cast<int>(&Pet::set), "Set the pet's age") 648 .def("set", py::overload_cast<const std::string &>(&Pet::set), "Set the pet's name"); 649 650 This feature only works on C++14-capable compilers. 651 `#541 <https://github.com/pybind/pybind11/pull/541>`_. 652 653* C++ types are automatically cast to Python types, e.g. when assigning 654 them as an attribute. For instance, the following is now legal: 655 656 .. code-block:: cpp 657 658 py::module m = /* ... */ 659 m.attr("constant") = 123; 660 661 (Previously, a ``py::cast`` call was necessary to avoid a compilation error.) 662 `#551 <https://github.com/pybind/pybind11/pull/551>`_. 663 664* Redesigned ``pytest``-based test suite. `#321 <https://github.com/pybind/pybind11/pull/321>`_. 665 666* Instance tracking to detect reference leaks in test suite. `#324 <https://github.com/pybind/pybind11/pull/324>`_ 667 668* pybind11 can now distinguish between multiple different instances that are 669 located at the same memory address, but which have different types. 670 `#329 <https://github.com/pybind/pybind11/pull/329>`_. 671 672* Improved logic in ``move`` return value policy. 673 `#510 <https://github.com/pybind/pybind11/pull/510>`_, 674 `#297 <https://github.com/pybind/pybind11/pull/297>`_. 675 676* Generalized unpacking API to permit calling Python functions from C++ using 677 notation such as ``foo(a1, a2, *args, "ka"_a=1, "kb"_a=2, **kwargs)``. `#372 <https://github.com/pybind/pybind11/pull/372>`_. 678 679* ``py::print()`` function whose behavior matches that of the native Python 680 ``print()`` function. `#372 <https://github.com/pybind/pybind11/pull/372>`_. 681 682* Added ``py::dict`` keyword constructor:``auto d = dict("number"_a=42, 683 "name"_a="World");``. `#372 <https://github.com/pybind/pybind11/pull/372>`_. 684 685* Added ``py::str::format()`` method and ``_s`` literal: ``py::str s = "1 + 2 686 = {}"_s.format(3);``. `#372 <https://github.com/pybind/pybind11/pull/372>`_. 687 688* Added ``py::repr()`` function which is equivalent to Python's builtin 689 ``repr()``. `#333 <https://github.com/pybind/pybind11/pull/333>`_. 690 691* Improved construction and destruction logic for holder types. It is now 692 possible to reference instances with smart pointer holder types without 693 constructing the holder if desired. The ``PYBIND11_DECLARE_HOLDER_TYPE`` 694 macro now accepts an optional second parameter to indicate whether the holder 695 type uses intrusive reference counting. 696 `#533 <https://github.com/pybind/pybind11/pull/533>`_ and 697 `#561 <https://github.com/pybind/pybind11/pull/561>`_. 698 699* Mapping a stateless C++ function to Python and back is now "for free" (i.e. 700 no extra indirections or argument conversion overheads). `rev. 954b79 701 <https://github.com/pybind/pybind11/commit/954b79>`_. 702 703* Bindings for ``std::valarray<T>``. 704 `#545 <https://github.com/pybind/pybind11/pull/545>`_. 705 706* Improved support for C++17 capable compilers. 707 `#562 <https://github.com/pybind/pybind11/pull/562>`_. 708 709* Bindings for ``std::optional<t>``. 710 `#475 <https://github.com/pybind/pybind11/pull/475>`_, 711 `#476 <https://github.com/pybind/pybind11/pull/476>`_, 712 `#479 <https://github.com/pybind/pybind11/pull/479>`_, 713 `#499 <https://github.com/pybind/pybind11/pull/499>`_, and 714 `#501 <https://github.com/pybind/pybind11/pull/501>`_. 715 716* ``stl_bind.h``: general improvements and support for ``std::map`` and 717 ``std::unordered_map``. 718 `#490 <https://github.com/pybind/pybind11/pull/490>`_, 719 `#282 <https://github.com/pybind/pybind11/pull/282>`_, 720 `#235 <https://github.com/pybind/pybind11/pull/235>`_. 721 722* The ``std::tuple``, ``std::pair``, ``std::list``, and ``std::vector`` type 723 casters now accept any Python sequence type as input. `rev. 107285 724 <https://github.com/pybind/pybind11/commit/107285>`_. 725 726* Improved CMake Python detection on multi-architecture Linux. 727 `#532 <https://github.com/pybind/pybind11/pull/532>`_. 728 729* Infrastructure to selectively disable or enable parts of the automatically 730 generated docstrings. `#486 <https://github.com/pybind/pybind11/pull/486>`_. 731 732* ``reference`` and ``reference_internal`` are now the default return value 733 properties for static and non-static properties, respectively. `#473 734 <https://github.com/pybind/pybind11/pull/473>`_. (the previous defaults 735 were ``automatic``). `#473 <https://github.com/pybind/pybind11/pull/473>`_. 736 737* Support for ``std::unique_ptr`` with non-default deleters or no deleter at 738 all (``py::nodelete``). `#384 <https://github.com/pybind/pybind11/pull/384>`_. 739 740* Deprecated ``handle::call()`` method. The new syntax to call Python 741 functions is simply ``handle()``. It can also be invoked explicitly via 742 ``handle::operator<X>()``, where ``X`` is an optional return value policy. 743 744* Print more informative error messages when ``make_tuple()`` or ``cast()`` 745 fail. `#262 <https://github.com/pybind/pybind11/pull/262>`_. 746 747* Creation of holder types for classes deriving from 748 ``std::enable_shared_from_this<>`` now also works for ``const`` values. 749 `#260 <https://github.com/pybind/pybind11/pull/260>`_. 750 751* ``make_iterator()`` improvements for better compatibility with various 752 types (now uses prefix increment operator); it now also accepts iterators 753 with different begin/end types as long as they are equality comparable. 754 `#247 <https://github.com/pybind/pybind11/pull/247>`_. 755 756* ``arg()`` now accepts a wider range of argument types for default values. 757 `#244 <https://github.com/pybind/pybind11/pull/244>`_. 758 759* Support ``keep_alive`` where the nurse object may be ``None``. `#341 760 <https://github.com/pybind/pybind11/pull/341>`_. 761 762* Added constructors for ``str`` and ``bytes`` from zero-terminated char 763 pointers, and from char pointers and length. Added constructors for ``str`` 764 from ``bytes`` and for ``bytes`` from ``str``, which will perform UTF-8 765 decoding/encoding as required. 766 767* Many other improvements of library internals without user-visible changes 768 769 7701.8.1 (July 12, 2016) 771---------------------- 772* Fixed a rare but potentially very severe issue when the garbage collector ran 773 during pybind11 type creation. 774 7751.8.0 (June 14, 2016) 776---------------------- 777* Redesigned CMake build system which exports a convenient 778 ``pybind11_add_module`` function to parent projects. 779* ``std::vector<>`` type bindings analogous to Boost.Python's ``indexing_suite`` 780* Transparent conversion of sparse and dense Eigen matrices and vectors (``eigen.h``) 781* Added an ``ExtraFlags`` template argument to the NumPy ``array_t<>`` wrapper 782 to disable an enforced cast that may lose precision, e.g. to create overloads 783 for different precisions and complex vs real-valued matrices. 784* Prevent implicit conversion of floating point values to integral types in 785 function arguments 786* Fixed incorrect default return value policy for functions returning a shared 787 pointer 788* Don't allow registering a type via ``class_`` twice 789* Don't allow casting a ``None`` value into a C++ lvalue reference 790* Fixed a crash in ``enum_::operator==`` that was triggered by the ``help()`` command 791* Improved detection of whether or not custom C++ types can be copy/move-constructed 792* Extended ``str`` type to also work with ``bytes`` instances 793* Added a ``"name"_a`` user defined string literal that is equivalent to ``py::arg("name")``. 794* When specifying function arguments via ``py::arg``, the test that verifies 795 the number of arguments now runs at compile time. 796* Added ``[[noreturn]]`` attribute to ``pybind11_fail()`` to quench some 797 compiler warnings 798* List function arguments in exception text when the dispatch code cannot find 799 a matching overload 800* Added ``PYBIND11_OVERLOAD_NAME`` and ``PYBIND11_OVERLOAD_PURE_NAME`` macros which 801 can be used to override virtual methods whose name differs in C++ and Python 802 (e.g. ``__call__`` and ``operator()``) 803* Various minor ``iterator`` and ``make_iterator()`` improvements 804* Transparently support ``__bool__`` on Python 2.x and Python 3.x 805* Fixed issue with destructor of unpickled object not being called 806* Minor CMake build system improvements on Windows 807* New ``pybind11::args`` and ``pybind11::kwargs`` types to create functions which 808 take an arbitrary number of arguments and keyword arguments 809* New syntax to call a Python function from C++ using ``*args`` and ``*kwargs`` 810* The functions ``def_property_*`` now correctly process docstring arguments (these 811 formerly caused a segmentation fault) 812* Many ``mkdoc.py`` improvements (enumerations, template arguments, ``DOC()`` 813 macro accepts more arguments) 814* Cygwin support 815* Documentation improvements (pickling support, ``keep_alive``, macro usage) 816 8171.7 (April 30, 2016) 818---------------------- 819* Added a new ``move`` return value policy that triggers C++11 move semantics. 820 The automatic return value policy falls back to this case whenever a rvalue 821 reference is encountered 822* Significantly more general GIL state routines that are used instead of 823 Python's troublesome ``PyGILState_Ensure`` and ``PyGILState_Release`` API 824* Redesign of opaque types that drastically simplifies their usage 825* Extended ability to pass values of type ``[const] void *`` 826* ``keep_alive`` fix: don't fail when there is no patient 827* ``functional.h``: acquire the GIL before calling a Python function 828* Added Python RAII type wrappers ``none`` and ``iterable`` 829* Added ``*args`` and ``*kwargs`` pass-through parameters to 830 ``pybind11.get_include()`` function 831* Iterator improvements and fixes 832* Documentation on return value policies and opaque types improved 833 8341.6 (April 30, 2016) 835---------------------- 836* Skipped due to upload to PyPI gone wrong and inability to recover 837 (https://github.com/pypa/packaging-problems/issues/74) 838 8391.5 (April 21, 2016) 840---------------------- 841* For polymorphic types, use RTTI to try to return the closest type registered with pybind11 842* Pickling support for serializing and unserializing C++ instances to a byte stream in Python 843* Added a convenience routine ``make_iterator()`` which turns a range indicated 844 by a pair of C++ iterators into a iterable Python object 845* Added ``len()`` and a variadic ``make_tuple()`` function 846* Addressed a rare issue that could confuse the current virtual function 847 dispatcher and another that could lead to crashes in multi-threaded 848 applications 849* Added a ``get_include()`` function to the Python module that returns the path 850 of the directory containing the installed pybind11 header files 851* Documentation improvements: import issues, symbol visibility, pickling, limitations 852* Added casting support for ``std::reference_wrapper<>`` 853 8541.4 (April 7, 2016) 855-------------------------- 856* Transparent type conversion for ``std::wstring`` and ``wchar_t`` 857* Allow passing ``nullptr``-valued strings 858* Transparent passing of ``void *`` pointers using capsules 859* Transparent support for returning values wrapped in ``std::unique_ptr<>`` 860* Improved docstring generation for compatibility with Sphinx 861* Nicer debug error message when default parameter construction fails 862* Support for "opaque" types that bypass the transparent conversion layer for STL containers 863* Redesigned type casting interface to avoid ambiguities that could occasionally cause compiler errors 864* Redesigned property implementation; fixes crashes due to an unfortunate default return value policy 865* Anaconda package generation support 866 8671.3 (March 8, 2016) 868-------------------------- 869 870* Added support for the Intel C++ compiler (v15+) 871* Added support for the STL unordered set/map data structures 872* Added support for the STL linked list data structure 873* NumPy-style broadcasting support in ``pybind11::vectorize`` 874* pybind11 now displays more verbose error messages when ``arg::operator=()`` fails 875* pybind11 internal data structures now live in a version-dependent namespace to avoid ABI issues 876* Many, many bugfixes involving corner cases and advanced usage 877 8781.2 (February 7, 2016) 879-------------------------- 880 881* Optional: efficient generation of function signatures at compile time using C++14 882* Switched to a simpler and more general way of dealing with function default 883 arguments. Unused keyword arguments in function calls are now detected and 884 cause errors as expected 885* New ``keep_alive`` call policy analogous to Boost.Python's ``with_custodian_and_ward`` 886* New ``pybind11::base<>`` attribute to indicate a subclass relationship 887* Improved interface for RAII type wrappers in ``pytypes.h`` 888* Use RAII type wrappers consistently within pybind11 itself. This 889 fixes various potential refcount leaks when exceptions occur 890* Added new ``bytes`` RAII type wrapper (maps to ``string`` in Python 2.7) 891* Made handle and related RAII classes const correct, using them more 892 consistently everywhere now 893* Got rid of the ugly ``__pybind11__`` attributes on the Python side---they are 894 now stored in a C++ hash table that is not visible in Python 895* Fixed refcount leaks involving NumPy arrays and bound functions 896* Vastly improved handling of shared/smart pointers 897* Removed an unnecessary copy operation in ``pybind11::vectorize`` 898* Fixed naming clashes when both pybind11 and NumPy headers are included 899* Added conversions for additional exception types 900* Documentation improvements (using multiple extension modules, smart pointers, 901 other minor clarifications) 902* unified infrastructure for parsing variadic arguments in ``class_`` and cpp_function 903* Fixed license text (was: ZLIB, should have been: 3-clause BSD) 904* Python 3.2 compatibility 905* Fixed remaining issues when accessing types in another plugin module 906* Added enum comparison and casting methods 907* Improved SFINAE-based detection of whether types are copy-constructible 908* Eliminated many warnings about unused variables and the use of ``offsetof()`` 909* Support for ``std::array<>`` conversions 910 9111.1 (December 7, 2015) 912-------------------------- 913 914* Documentation improvements (GIL, wrapping functions, casting, fixed many typos) 915* Generalized conversion of integer types 916* Improved support for casting function objects 917* Improved support for ``std::shared_ptr<>`` conversions 918* Initial support for ``std::set<>`` conversions 919* Fixed type resolution issue for types defined in a separate plugin module 920* Cmake build system improvements 921* Factored out generic functionality to non-templated code (smaller code size) 922* Added a code size / compile time benchmark vs Boost.Python 923* Added an appveyor CI script 924 9251.0 (October 15, 2015) 926------------------------ 927* Initial release 928