github.com/kaydxh/golang@v0.0.131/pkg/gocv/cgo/third_path/pybind11/docs/changelog.rst (about) 1 .. _changelog: 2 3 Changelog 4 ######### 5 6 Starting with version 1.8.0, pybind11 releases use a `semantic versioning 7 <http://semver.org>`_ policy. 8 9 Changes will be added here periodically from the "Suggested changelog entry" 10 block in pull request descriptions. 11 12 13 IN DEVELOPMENT 14 -------------- 15 16 Changes will be summarized here periodically. 17 18 Changes: 19 20 * ``PyGILState_Check()``'s in ``pybind11::handle``'s ``inc_ref()`` & 21 ``dec_ref()`` are now enabled by default again. 22 `#4246 <https://github.com/pybind/pybind11/pull/4246>`_ 23 24 * ``py::initialize_interpreter()`` using ``PyConfig_InitPythonConfig()`` 25 instead of ``PyConfig_InitIsolatedConfig()``, to obtain complete 26 ``sys.path``. 27 `#4473 <https://github.com/pybind/pybind11/pull/4473>`_ 28 29 * Cast errors now always include Python type information, even if 30 ``PYBIND11_DETAILED_ERROR_MESSAGES`` is not defined. This increases binary 31 sizes slightly (~1.5%) but the error messages are much more informative. 32 `#4463 <https://github.com/pybind/pybind11/pull/4463>`_ 33 34 35 Build system improvements: 36 37 * Update clang-tidy to 15 in CI. 38 `#4387 <https://github.com/pybind/pybind11/pull/4387>`_ 39 40 * Moved the linting framework over to Ruff. 41 `#4483 <https://github.com/pybind/pybind11/pull/4483>`_ 42 43 Version 2.10.4 (Mar 16, 2023) 44 ---------------------------- 45 46 Changes: 47 48 * ``python3 -m pybind11`` gained a ``--version`` option (prints the version and 49 exits). 50 `#4526 <https://github.com/pybind/pybind11/pull/4526>`_ 51 52 Bug Fixes: 53 54 * Fix a warning when pydebug is enabled on Python 3.11. 55 `#4461 <https://github.com/pybind/pybind11/pull/4461>`_ 56 57 * Ensure ``gil_scoped_release`` RAII is non-copyable. 58 `#4490 <https://github.com/pybind/pybind11/pull/4490>`_ 59 60 * Ensure the tests dir does not show up with new versions of setuptools. 61 `#4510 <https://github.com/pybind/pybind11/pull/4510>`_ 62 63 * Better stacklevel for a warning in setuptools helpers. 64 `#4516 <https://github.com/pybind/pybind11/pull/4516>`_ 65 66 Version 2.10.3 (Jan 3, 2023) 67 ---------------------------- 68 69 Changes: 70 71 * Temporarily made our GIL status assertions (added in 2.10.2) disabled by 72 default (re-enable manually by defining 73 ``PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF``, will be enabled in 2.11). 74 `#4432 <https://github.com/pybind/pybind11/pull/4432>`_ 75 76 * Improved error messages when ``inc_ref``/``dec_ref`` are called with an 77 invalid GIL state. 78 `#4427 <https://github.com/pybind/pybind11/pull/4427>`_ 79 `#4436 <https://github.com/pybind/pybind11/pull/4436>`_ 80 81 Bug Fixes: 82 83 * Some minor touchups found by static analyzers. 84 `#4440 <https://github.com/pybind/pybind11/pull/4440>`_ 85 86 87 Version 2.10.2 (Dec 20, 2022) 88 ----------------------------- 89 90 Changes: 91 92 * ``scoped_interpreter`` constructor taking ``PyConfig``. 93 `#4330 <https://github.com/pybind/pybind11/pull/4330>`_ 94 95 * ``pybind11/eigen/tensor.h`` adds converters to and from ``Eigen::Tensor`` and 96 ``Eigen::TensorMap``. 97 `#4201 <https://github.com/pybind/pybind11/pull/4201>`_ 98 99 * ``PyGILState_Check()``'s were integrated to ``pybind11::handle`` 100 ``inc_ref()`` & ``dec_ref()``. The added GIL checks are guarded by 101 ``PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF``, which is the default only if 102 ``NDEBUG`` is not defined. (Made non-default in 2.10.3, will be active in 2.11) 103 `#4246 <https://github.com/pybind/pybind11/pull/4246>`_ 104 105 * Add option for enable/disable enum members in docstring. 106 `#2768 <https://github.com/pybind/pybind11/pull/2768>`_ 107 108 * Fixed typing of ``KeysView``, ``ValuesView`` and ``ItemsView`` in ``bind_map``. 109 `#4353 <https://github.com/pybind/pybind11/pull/4353>`_ 110 111 Bug fixes: 112 113 * Bug fix affecting only Python 3.6 under very specific, uncommon conditions: 114 move ``PyEval_InitThreads()`` call to the correct location. 115 `#4350 <https://github.com/pybind/pybind11/pull/4350>`_ 116 117 * Fix segfault bug when passing foreign native functions to functional.h. 118 `#4254 <https://github.com/pybind/pybind11/pull/4254>`_ 119 120 Build system improvements: 121 122 * Support setting PYTHON_LIBRARIES manually for Windows ARM cross-compilation 123 (classic mode). 124 `#4406 <https://github.com/pybind/pybind11/pull/4406>`_ 125 126 * Extend IPO/LTO detection for ICX (a.k.a IntelLLVM) compiler. 127 `#4402 <https://github.com/pybind/pybind11/pull/4402>`_ 128 129 * Allow calling ``find_package(pybind11 CONFIG)`` multiple times from separate 130 directories in the same CMake project and properly link Python (new mode). 131 `#4401 <https://github.com/pybind/pybind11/pull/4401>`_ 132 133 * ``multiprocessing_set_spawn`` in pytest fixture for added safety. 134 `#4377 <https://github.com/pybind/pybind11/pull/4377>`_ 135 136 * Fixed a bug in two pybind11/tools cmake scripts causing "Unknown arguments specified" errors. 137 `#4327 <https://github.com/pybind/pybind11/pull/4327>`_ 138 139 140 141 Version 2.10.1 (Oct 31, 2022) 142 ----------------------------- 143 144 This is the first version to fully support embedding the newly released Python 3.11. 145 146 Changes: 147 148 * Allow ``pybind11::capsule`` constructor to take null destructor pointers. 149 `#4221 <https://github.com/pybind/pybind11/pull/4221>`_ 150 151 * ``embed.h`` was changed so that ``PYTHONPATH`` is used also with Python 3.11 152 (established behavior). 153 `#4119 <https://github.com/pybind/pybind11/pull/4119>`_ 154 155 * A ``PYBIND11_SIMPLE_GIL_MANAGEMENT`` option was added (cmake, C++ define), 156 along with many additional tests in ``test_gil_scoped.py``. The option may be 157 useful to try when debugging GIL-related issues, to determine if the more 158 complex default implementation is or is not to blame. See #4216 for 159 background. WARNING: Please be careful to not create ODR violations when 160 using the option: everything that is linked together with mutual symbol 161 visibility needs to be rebuilt. 162 `#4216 <https://github.com/pybind/pybind11/pull/4216>`_ 163 164 * ``PYBIND11_EXPORT_EXCEPTION`` was made non-empty only under macOS. This makes 165 Linux builds safer, and enables the removal of warning suppression pragmas for 166 Windows. 167 `#4298 <https://github.com/pybind/pybind11/pull/4298>`_ 168 169 Bug fixes: 170 171 * Fixed a bug where ``UnicodeDecodeError`` was not propagated from various 172 ``py::str`` ctors when decoding surrogate utf characters. 173 `#4294 <https://github.com/pybind/pybind11/pull/4294>`_ 174 175 * Revert perfect forwarding for ``make_iterator``. This broke at least one 176 valid use case. May revisit later. 177 `#4234 <https://github.com/pybind/pybind11/pull/4234>`_ 178 179 * Fix support for safe casts to ``void*`` (regression in 2.10.0). 180 `#4275 <https://github.com/pybind/pybind11/pull/4275>`_ 181 182 * Fix ``char8_t`` support (regression in 2.9). 183 `#4278 <https://github.com/pybind/pybind11/pull/4278>`_ 184 185 * Unicode surrogate character in Python exception message leads to process 186 termination in ``error_already_set::what()``. 187 `#4297 <https://github.com/pybind/pybind11/pull/4297>`_ 188 189 * Fix MSVC 2019 v.1924 & C++14 mode error for ``overload_cast``. 190 `#4188 <https://github.com/pybind/pybind11/pull/4188>`_ 191 192 * Make augmented assignment operators non-const for the object-api. Behavior 193 was previously broken for augmented assignment operators. 194 `#4065 <https://github.com/pybind/pybind11/pull/4065>`_ 195 196 * Add proper error checking to C++ bindings for Python list append and insert. 197 `#4208 <https://github.com/pybind/pybind11/pull/4208>`_ 198 199 * Work-around for Nvidia's CUDA nvcc compiler in versions 11.4.0 - 11.8.0. 200 `#4220 <https://github.com/pybind/pybind11/pull/4220>`_ 201 202 * A workaround for PyPy was added in the ``py::error_already_set`` 203 implementation, related to PR `#1895 <https://github.com/pybind/pybind11/pull/1895>`_ 204 released with v2.10.0. 205 `#4079 <https://github.com/pybind/pybind11/pull/4079>`_ 206 207 * Fixed compiler errors when C++23 ``std::forward_like`` is available. 208 `#4136 <https://github.com/pybind/pybind11/pull/4136>`_ 209 210 * Properly raise exceptions in contains methods (like when an object in unhashable). 211 `#4209 <https://github.com/pybind/pybind11/pull/4209>`_ 212 213 * Further improve another error in exception handling. 214 `#4232 <https://github.com/pybind/pybind11/pull/4232>`_ 215 216 * ``get_local_internals()`` was made compatible with 217 ``finalize_interpreter()``, fixing potential freezes during interpreter 218 finalization. 219 `#4192 <https://github.com/pybind/pybind11/pull/4192>`_ 220 221 Performance and style: 222 223 * Reserve space in set and STL map casters if possible. This will prevent 224 unnecessary rehashing / resizing by knowing the number of keys ahead of time 225 for Python to C++ casting. This improvement will greatly speed up the casting 226 of large unordered maps and sets. 227 `#4194 <https://github.com/pybind/pybind11/pull/4194>`_ 228 229 * GIL RAII scopes are non-copyable to avoid potential bugs. 230 `#4183 <https://github.com/pybind/pybind11/pull/4183>`_ 231 232 * Explicitly default all relevant ctors for pytypes in the ``PYBIND11_OBJECT`` 233 macros and enforce the clang-tidy checks ``modernize-use-equals-default`` in 234 macros as well. 235 `#4017 <https://github.com/pybind/pybind11/pull/4017>`_ 236 237 * Optimize iterator advancement in C++ bindings. 238 `#4237 <https://github.com/pybind/pybind11/pull/4237>`_ 239 240 * Use the modern ``PyObject_GenericGetDict`` and ``PyObject_GenericSetDict`` 241 for handling dynamic attribute dictionaries. 242 `#4106 <https://github.com/pybind/pybind11/pull/4106>`_ 243 244 * Document that users should use ``PYBIND11_NAMESPACE`` instead of using ``pybind11`` when 245 opening namespaces. Using namespace declarations and namespace qualification 246 remain the same as ``pybind11``. This is done to ensure consistent symbol 247 visibility. 248 `#4098 <https://github.com/pybind/pybind11/pull/4098>`_ 249 250 * Mark ``detail::forward_like`` as constexpr. 251 `#4147 <https://github.com/pybind/pybind11/pull/4147>`_ 252 253 * Optimize unpacking_collector when processing ``arg_v`` arguments. 254 `#4219 <https://github.com/pybind/pybind11/pull/4219>`_ 255 256 * Optimize casting C++ object to ``None``. 257 `#4269 <https://github.com/pybind/pybind11/pull/4269>`_ 258 259 260 Build system improvements: 261 262 * CMake: revert overwrite behavior, now opt-in with ``PYBIND11_PYTHONLIBS_OVERRWRITE OFF``. 263 `#4195 <https://github.com/pybind/pybind11/pull/4195>`_ 264 265 * Include a pkg-config file when installing pybind11, such as in the Python 266 package. 267 `#4077 <https://github.com/pybind/pybind11/pull/4077>`_ 268 269 * Avoid stripping debug symbols when ``CMAKE_BUILD_TYPE`` is set to ``DEBUG`` 270 instead of ``Debug``. 271 `#4078 <https://github.com/pybind/pybind11/pull/4078>`_ 272 273 * Followup to `#3948 <https://github.com/pybind/pybind11/pull/3948>`_, fixing vcpkg again. 274 `#4123 <https://github.com/pybind/pybind11/pull/4123>`_ 275 276 Version 2.10.0 (Jul 15, 2022) 277 ----------------------------- 278 279 Removed support for Python 2.7, Python 3.5, and MSVC 2015. Support for MSVC 280 2017 is limited due to availability of CI runners; we highly recommend MSVC 281 2019 or 2022 be used. Initial support added for Python 3.11. 282 283 New features: 284 285 * ``py::anyset`` & ``py::frozenset`` were added, with copying (cast) to 286 ``std::set`` (similar to ``set``). 287 `#3901 <https://github.com/pybind/pybind11/pull/3901>`_ 288 289 * Support bytearray casting to string. 290 `#3707 <https://github.com/pybind/pybind11/pull/3707>`_ 291 292 * ``type_caster<std::monostate>`` was added. ``std::monostate`` is a tag type 293 that allows ``std::variant`` to act as an optional, or allows default 294 construction of a ``std::variant`` holding a non-default constructible type. 295 `#3818 <https://github.com/pybind/pybind11/pull/3818>`_ 296 297 * ``pybind11::capsule::set_name`` added to mutate the name of the capsule instance. 298 `#3866 <https://github.com/pybind/pybind11/pull/3866>`_ 299 300 * NumPy: dtype constructor from type number added, accessors corresponding to 301 Python API ``dtype.num``, ``dtype.byteorder``, ``dtype.flags`` and 302 ``dtype.alignment`` added. 303 `#3868 <https://github.com/pybind/pybind11/pull/3868>`_ 304 305 306 Changes: 307 308 * Python 3.6 is now the minimum supported version. 309 `#3688 <https://github.com/pybind/pybind11/pull/3688>`_ 310 `#3719 <https://github.com/pybind/pybind11/pull/3719>`_ 311 312 * The minimum version for MSVC is now 2017. 313 `#3722 <https://github.com/pybind/pybind11/pull/3722>`_ 314 315 * Fix issues with CPython 3.11 betas and add to supported test matrix. 316 `#3923 <https://github.com/pybind/pybind11/pull/3923>`_ 317 318 * ``error_already_set`` is now safer and more performant, especially for 319 exceptions with long tracebacks, by delaying computation. 320 `#1895 <https://github.com/pybind/pybind11/pull/1895>`_ 321 322 * Improve exception handling in python ``str`` bindings. 323 `#3826 <https://github.com/pybind/pybind11/pull/3826>`_ 324 325 * The bindings for capsules now have more consistent exception handling. 326 `#3825 <https://github.com/pybind/pybind11/pull/3825>`_ 327 328 * ``PYBIND11_OBJECT_CVT`` and ``PYBIND11_OBJECT_CVT_DEFAULT`` macro can now be 329 used to define classes in namespaces other than pybind11. 330 `#3797 <https://github.com/pybind/pybind11/pull/3797>`_ 331 332 * Error printing code now uses ``PYBIND11_DETAILED_ERROR_MESSAGES`` instead of 333 requiring ``NDEBUG``, allowing use with release builds if desired. 334 `#3913 <https://github.com/pybind/pybind11/pull/3913>`_ 335 336 * Implicit conversion of the literal ``0`` to ``pybind11::handle`` is now disabled. 337 `#4008 <https://github.com/pybind/pybind11/pull/4008>`_ 338 339 340 Bug fixes: 341 342 * Fix exception handling when ``pybind11::weakref()`` fails. 343 `#3739 <https://github.com/pybind/pybind11/pull/3739>`_ 344 345 * ``module_::def_submodule`` was missing proper error handling. This is fixed now. 346 `#3973 <https://github.com/pybind/pybind11/pull/3973>`_ 347 348 * The behavior or ``error_already_set`` was made safer and the highly opaque 349 "Unknown internal error occurred" message was replaced with a more helpful 350 message. 351 `#3982 <https://github.com/pybind/pybind11/pull/3982>`_ 352 353 * ``error_already_set::what()`` now handles non-normalized exceptions correctly. 354 `#3971 <https://github.com/pybind/pybind11/pull/3971>`_ 355 356 * Support older C++ compilers where filesystem is not yet part of the standard 357 library and is instead included in ``std::experimental::filesystem``. 358 `#3840 <https://github.com/pybind/pybind11/pull/3840>`_ 359 360 * Fix ``-Wfree-nonheap-object`` warnings produced by GCC by avoiding returning 361 pointers to static objects with ``return_value_policy::take_ownership``. 362 `#3946 <https://github.com/pybind/pybind11/pull/3946>`_ 363 364 * Fix cast from pytype rvalue to another pytype. 365 `#3949 <https://github.com/pybind/pybind11/pull/3949>`_ 366 367 * Ensure proper behavior when garbage collecting classes with dynamic attributes in Python >=3.9. 368 `#4051 <https://github.com/pybind/pybind11/pull/4051>`_ 369 370 * A couple long-standing ``PYBIND11_NAMESPACE`` 371 ``__attribute__((visibility("hidden")))`` inconsistencies are now fixed 372 (affects only unusual environments). 373 `#4043 <https://github.com/pybind/pybind11/pull/4043>`_ 374 375 * ``pybind11::detail::get_internals()`` is now resilient to in-flight Python 376 exceptions. 377 `#3981 <https://github.com/pybind/pybind11/pull/3981>`_ 378 379 * Arrays with a dimension of size 0 are now properly converted to dynamic Eigen 380 matrices (more common in NumPy 1.23). 381 `#4038 <https://github.com/pybind/pybind11/pull/4038>`_ 382 383 * Avoid catching unrelated errors when importing NumPy. 384 `#3974 <https://github.com/pybind/pybind11/pull/3974>`_ 385 386 Performance and style: 387 388 * Added an accessor overload of ``(object &&key)`` to reference steal the 389 object when using python types as keys. This prevents unnecessary reference 390 count overhead for attr, dictionary, tuple, and sequence look ups. Added 391 additional regression tests. Fixed a performance bug the caused accessor 392 assignments to potentially perform unnecessary copies. 393 `#3970 <https://github.com/pybind/pybind11/pull/3970>`_ 394 395 * Perfect forward all args of ``make_iterator``. 396 `#3980 <https://github.com/pybind/pybind11/pull/3980>`_ 397 398 * Avoid potential bug in pycapsule destructor by adding an ``error_guard`` to 399 one of the dtors. 400 `#3958 <https://github.com/pybind/pybind11/pull/3958>`_ 401 402 * Optimize dictionary access in ``strip_padding`` for numpy. 403 `#3994 <https://github.com/pybind/pybind11/pull/3994>`_ 404 405 * ``stl_bind.h`` bindings now take slice args as a const-ref. 406 `#3852 <https://github.com/pybind/pybind11/pull/3852>`_ 407 408 * Made slice constructor more consistent, and improve performance of some 409 casters by allowing reference stealing. 410 `#3845 <https://github.com/pybind/pybind11/pull/3845>`_ 411 412 * Change numpy dtype from_args method to use const ref. 413 `#3878 <https://github.com/pybind/pybind11/pull/3878>`_ 414 415 * Follow rule of three to ensure ``PyErr_Restore`` is called only once. 416 `#3872 <https://github.com/pybind/pybind11/pull/3872>`_ 417 418 * Added missing perfect forwarding for ``make_iterator`` functions. 419 `#3860 <https://github.com/pybind/pybind11/pull/3860>`_ 420 421 * Optimize c++ to python function casting by using the rvalue caster. 422 `#3966 <https://github.com/pybind/pybind11/pull/3966>`_ 423 424 * Optimize Eigen sparse matrix casting by removing unnecessary temporary. 425 `#4064 <https://github.com/pybind/pybind11/pull/4064>`_ 426 427 * Avoid potential implicit copy/assignment constructors causing double free in 428 ``strdup_gaurd``. 429 `#3905 <https://github.com/pybind/pybind11/pull/3905>`_ 430 431 * Enable clang-tidy checks ``misc-definitions-in-headers``, 432 ``modernize-loop-convert``, and ``modernize-use-nullptr``. 433 `#3881 <https://github.com/pybind/pybind11/pull/3881>`_ 434 `#3988 <https://github.com/pybind/pybind11/pull/3988>`_ 435 436 437 Build system improvements: 438 439 * CMake: Fix file extension on Windows with cp36 and cp37 using FindPython. 440 `#3919 <https://github.com/pybind/pybind11/pull/3919>`_ 441 442 * CMake: Support multiple Python targets (such as on vcpkg). 443 `#3948 <https://github.com/pybind/pybind11/pull/3948>`_ 444 445 * CMake: Fix issue with NVCC on Windows. 446 `#3947 <https://github.com/pybind/pybind11/pull/3947>`_ 447 448 * CMake: Drop the bitness check on cross compiles (like targeting WebAssembly 449 via Emscripten). 450 `#3959 <https://github.com/pybind/pybind11/pull/3959>`_ 451 452 * Add MSVC builds in debug mode to CI. 453 `#3784 <https://github.com/pybind/pybind11/pull/3784>`_ 454 455 * MSVC 2022 C++20 coverage was added to GitHub Actions, including Eigen. 456 `#3732 <https://github.com/pybind/pybind11/pull/3732>`_, 457 `#3741 <https://github.com/pybind/pybind11/pull/3741>`_ 458 459 460 Backend and tidying up: 461 462 * New theme for the documentation. 463 `#3109 <https://github.com/pybind/pybind11/pull/3109>`_ 464 465 * Remove idioms in code comments. Use more inclusive language. 466 `#3809 <https://github.com/pybind/pybind11/pull/3809>`_ 467 468 * ``#include <iostream>`` was removed from the ``pybind11/stl.h`` header. Your 469 project may break if it has a transitive dependency on this include. The fix 470 is to "Include What You Use". 471 `#3928 <https://github.com/pybind/pybind11/pull/3928>`_ 472 473 * Avoid ``setup.py <command>`` usage in internal tests. 474 `#3734 <https://github.com/pybind/pybind11/pull/3734>`_ 475 476 477 Version 2.9.2 (Mar 29, 2022) 478 ---------------------------- 479 480 Changes: 481 482 * Enum now has an ``__index__`` method on Python <3.8 too. 483 `#3700 <https://github.com/pybind/pybind11/pull/3700>`_ 484 485 * Local internals are now cleared after finalizing the interpreter. 486 `#3744 <https://github.com/pybind/pybind11/pull/3744>`_ 487 488 Bug fixes: 489 490 * Better support for Python 3.11 alphas. 491 `#3694 <https://github.com/pybind/pybind11/pull/3694>`_ 492 493 * ``PYBIND11_TYPE_CASTER`` now uses fully qualified symbols, so it can be used 494 outside of ``pybind11::detail``. 495 `#3758 <https://github.com/pybind/pybind11/pull/3758>`_ 496 497 * Some fixes for PyPy 3.9. 498 `#3768 <https://github.com/pybind/pybind11/pull/3768>`_ 499 500 * Fixed a potential memleak in PyPy in ``get_type_override``. 501 `#3774 <https://github.com/pybind/pybind11/pull/3774>`_ 502 503 * Fix usage of ``VISIBILITY_INLINES_HIDDEN``. 504 `#3721 <https://github.com/pybind/pybind11/pull/3721>`_ 505 506 507 Build system improvements: 508 509 * Uses ``sysconfig`` module to determine installation locations on Python >= 510 3.10, instead of ``distutils`` which has been deprecated. 511 `#3764 <https://github.com/pybind/pybind11/pull/3764>`_ 512 513 * Support Catch 2.13.5+ (supporting GLIBC 2.34+). 514 `#3679 <https://github.com/pybind/pybind11/pull/3679>`_ 515 516 * Fix test failures with numpy 1.22 by ignoring whitespace when comparing 517 ``str()`` of dtypes. 518 `#3682 <https://github.com/pybind/pybind11/pull/3682>`_ 519 520 521 Backend and tidying up: 522 523 * clang-tidy: added ``readability-qualified-auto``, 524 ``readability-braces-around-statements``, 525 ``cppcoreguidelines-prefer-member-initializer``, 526 ``clang-analyzer-optin.performance.Padding``, 527 ``cppcoreguidelines-pro-type-static-cast-downcast``, and 528 ``readability-inconsistent-declaration-parameter-name``. 529 `#3702 <https://github.com/pybind/pybind11/pull/3702>`_, 530 `#3699 <https://github.com/pybind/pybind11/pull/3699>`_, 531 `#3716 <https://github.com/pybind/pybind11/pull/3716>`_, 532 `#3709 <https://github.com/pybind/pybind11/pull/3709>`_ 533 534 * clang-format was added to the pre-commit actions, and the entire code base 535 automatically reformatted (after several iterations preparing for this leap). 536 `#3713 <https://github.com/pybind/pybind11/pull/3713>`_ 537 538 539 Version 2.9.1 (Feb 2, 2022) 540 --------------------------- 541 542 Changes: 543 544 * If possible, attach Python exception with ``py::raise_from`` to ``TypeError`` 545 when casting from C++ to Python. This will give additional info if Python 546 exceptions occur in the caster. Adds a test case of trying to convert a set 547 from C++ to Python when the hash function is not defined in Python. 548 `#3605 <https://github.com/pybind/pybind11/pull/3605>`_ 549 550 * Add a mapping of C++11 nested exceptions to their Python exception 551 equivalent using ``py::raise_from``. This attaches the nested exceptions in 552 Python using the ``__cause__`` field. 553 `#3608 <https://github.com/pybind/pybind11/pull/3608>`_ 554 555 * Propagate Python exception traceback using ``raise_from`` if a pybind11 556 function runs out of overloads. 557 `#3671 <https://github.com/pybind/pybind11/pull/3671>`_ 558 559 * ``py::multiple_inheritance`` is now only needed when C++ bases are hidden 560 from pybind11. 561 `#3650 <https://github.com/pybind/pybind11/pull/3650>`_ and 562 `#3659 <https://github.com/pybind/pybind11/pull/3659>`_ 563 564 565 Bug fixes: 566 567 * Remove a boolean cast in ``numpy.h`` that causes MSVC C4800 warnings when 568 compiling against Python 3.10 or newer. 569 `#3669 <https://github.com/pybind/pybind11/pull/3669>`_ 570 571 * Render ``py::bool_`` and ``py::float_`` as ``bool`` and ``float`` 572 respectively. 573 `#3622 <https://github.com/pybind/pybind11/pull/3622>`_ 574 575 Build system improvements: 576 577 * Fix CMake extension suffix computation on Python 3.10+. 578 `#3663 <https://github.com/pybind/pybind11/pull/3663>`_ 579 580 * Allow ``CMAKE_ARGS`` to override CMake args in pybind11's own ``setup.py``. 581 `#3577 <https://github.com/pybind/pybind11/pull/3577>`_ 582 583 * Remove a few deprecated c-headers. 584 `#3610 <https://github.com/pybind/pybind11/pull/3610>`_ 585 586 * More uniform handling of test targets. 587 `#3590 <https://github.com/pybind/pybind11/pull/3590>`_ 588 589 * Add clang-tidy readability check to catch potentially swapped function args. 590 `#3611 <https://github.com/pybind/pybind11/pull/3611>`_ 591 592 593 Version 2.9.0 (Dec 28, 2021) 594 ---------------------------- 595 596 This is the last version to support Python 2.7 and 3.5. 597 598 New Features: 599 600 * Allow ``py::args`` to be followed by other arguments; the remaining arguments 601 are implicitly keyword-only, as if a ``py::kw_only{}`` annotation had been 602 used. 603 `#3402 <https://github.com/pybind/pybind11/pull/3402>`_ 604 605 Changes: 606 607 * Make str/bytes/memoryview more interoperable with ``std::string_view``. 608 `#3521 <https://github.com/pybind/pybind11/pull/3521>`_ 609 610 * Replace ``_`` with ``const_name`` in internals, avoid defining ``pybind::_`` 611 if ``_`` defined as macro (common gettext usage) 612 `#3423 <https://github.com/pybind/pybind11/pull/3423>`_ 613 614 615 Bug fixes: 616 617 * Fix a rare warning about extra copy in an Eigen constructor. 618 `#3486 <https://github.com/pybind/pybind11/pull/3486>`_ 619 620 * Fix caching of the C++ overrides. 621 `#3465 <https://github.com/pybind/pybind11/pull/3465>`_ 622 623 * Add missing ``std::forward`` calls to some ``cpp_function`` overloads. 624 `#3443 <https://github.com/pybind/pybind11/pull/3443>`_ 625 626 * Support PyPy 7.3.7 and the PyPy3.8 beta. Test python-3.11 on PRs with the 627 ``python dev`` label. 628 `#3419 <https://github.com/pybind/pybind11/pull/3419>`_ 629 630 * Replace usage of deprecated ``Eigen::MappedSparseMatrix`` with 631 ``Eigen::Map<Eigen::SparseMatrix<...>>`` for Eigen 3.3+. 632 `#3499 <https://github.com/pybind/pybind11/pull/3499>`_ 633 634 * Tweaks to support Microsoft Visual Studio 2022. 635 `#3497 <https://github.com/pybind/pybind11/pull/3497>`_ 636 637 Build system improvements: 638 639 * Nicer CMake printout and IDE organisation for pybind11's own tests. 640 `#3479 <https://github.com/pybind/pybind11/pull/3479>`_ 641 642 * CMake: report version type as part of the version string to avoid a spurious 643 space in the package status message. 644 `#3472 <https://github.com/pybind/pybind11/pull/3472>`_ 645 646 * Flags starting with ``-g`` in ``$CFLAGS`` and ``$CPPFLAGS`` are no longer 647 overridden by ``.Pybind11Extension``. 648 `#3436 <https://github.com/pybind/pybind11/pull/3436>`_ 649 650 * Ensure ThreadPool is closed in ``setup_helpers``. 651 `#3548 <https://github.com/pybind/pybind11/pull/3548>`_ 652 653 * Avoid LTS on ``mips64`` and ``ppc64le`` (reported broken). 654 `#3557 <https://github.com/pybind/pybind11/pull/3557>`_ 655 656 657 v2.8.1 (Oct 27, 2021) 658 --------------------- 659 660 Changes and additions: 661 662 * The simple namespace creation shortcut added in 2.8.0 was deprecated due to 663 usage of CPython internal API, and will be removed soon. Use 664 ``py::module_::import("types").attr("SimpleNamespace")``. 665 `#3374 <https://github.com/pybinyyd/pybind11/pull/3374>`_ 666 667 * Add C++ Exception type to throw and catch ``AttributeError``. Useful for 668 defining custom ``__setattr__`` and ``__getattr__`` methods. 669 `#3387 <https://github.com/pybind/pybind11/pull/3387>`_ 670 671 Fixes: 672 673 * Fixed the potential for dangling references when using properties with 674 ``std::optional`` types. 675 `#3376 <https://github.com/pybind/pybind11/pull/3376>`_ 676 677 * Modernize usage of ``PyCodeObject`` on Python 3.9+ (moving toward support for 678 Python 3.11a1) 679 `#3368 <https://github.com/pybind/pybind11/pull/3368>`_ 680 681 * A long-standing bug in ``eigen.h`` was fixed (originally PR #3343). The bug 682 was unmasked by newly added ``static_assert``'s in the Eigen 3.4.0 release. 683 `#3352 <https://github.com/pybind/pybind11/pull/3352>`_ 684 685 * Support multiple raw inclusion of CMake helper files (Conan.io does this for 686 multi-config generators). 687 `#3420 <https://github.com/pybind/pybind11/pull/3420>`_ 688 689 * Fix harmless warning on upcoming CMake 3.22. 690 `#3368 <https://github.com/pybind/pybind11/pull/3368>`_ 691 692 * Fix 2.8.0 regression with MSVC 2017 + C++17 mode + Python 3. 693 `#3407 <https://github.com/pybind/pybind11/pull/3407>`_ 694 695 * Fix 2.8.0 regression that caused undefined behavior (typically 696 segfaults) in ``make_key_iterator``/``make_value_iterator`` if dereferencing 697 the iterator returned a temporary value instead of a reference. 698 `#3348 <https://github.com/pybind/pybind11/pull/3348>`_ 699 700 701 v2.8.0 (Oct 4, 2021) 702 -------------------- 703 704 New features: 705 706 * Added ``py::raise_from`` to enable chaining exceptions. 707 `#3215 <https://github.com/pybind/pybind11/pull/3215>`_ 708 709 * Allow exception translators to be optionally registered local to a module 710 instead of applying globally across all pybind11 modules. Use 711 ``register_local_exception_translator(ExceptionTranslator&& translator)`` 712 instead of ``register_exception_translator(ExceptionTranslator&& 713 translator)`` to keep your exception remapping code local to the module. 714 `#2650 <https://github.com/pybinyyd/pybind11/pull/2650>`_ 715 716 * Add ``make_simple_namespace`` function for instantiating Python 717 ``SimpleNamespace`` objects. **Deprecated in 2.8.1.** 718 `#2840 <https://github.com/pybind/pybind11/pull/2840>`_ 719 720 * ``pybind11::scoped_interpreter`` and ``initialize_interpreter`` have new 721 arguments to allow ``sys.argv`` initialization. 722 `#2341 <https://github.com/pybind/pybind11/pull/2341>`_ 723 724 * Allow Python builtins to be used as callbacks in CPython. 725 `#1413 <https://github.com/pybind/pybind11/pull/1413>`_ 726 727 * Added ``view`` to view arrays with a different datatype. 728 `#987 <https://github.com/pybind/pybind11/pull/987>`_ 729 730 * Implemented ``reshape`` on arrays. 731 `#984 <https://github.com/pybind/pybind11/pull/984>`_ 732 733 * Enable defining custom ``__new__`` methods on classes by fixing bug 734 preventing overriding methods if they have non-pybind11 siblings. 735 `#3265 <https://github.com/pybind/pybind11/pull/3265>`_ 736 737 * Add ``make_value_iterator()``, and fix ``make_key_iterator()`` to return 738 references instead of copies. 739 `#3293 <https://github.com/pybind/pybind11/pull/3293>`_ 740 741 * Improve the classes generated by ``bind_map``: `#3310 <https://github.com/pybind/pybind11/pull/3310>`_ 742 743 * Change ``.items`` from an iterator to a dictionary view. 744 * Add ``.keys`` and ``.values`` (both dictionary views). 745 * Allow ``__contains__`` to take any object. 746 747 * ``pybind11::custom_type_setup`` was added, for customizing the 748 ``PyHeapTypeObject`` corresponding to a class, which may be useful for 749 enabling garbage collection support, among other things. 750 `#3287 <https://github.com/pybind/pybind11/pull/3287>`_ 751 752 753 Changes: 754 755 * Set ``__file__`` constant when running ``eval_file`` in an embedded interpreter. 756 `#3233 <https://github.com/pybind/pybind11/pull/3233>`_ 757 758 * Python objects and (C++17) ``std::optional`` now accepted in ``py::slice`` 759 constructor. 760 `#1101 <https://github.com/pybind/pybind11/pull/1101>`_ 761 762 * The pybind11 proxy types ``str``, ``bytes``, ``bytearray``, ``tuple``, 763 ``list`` now consistently support passing ``ssize_t`` values for sizes and 764 indexes. Previously, only ``size_t`` was accepted in several interfaces. 765 `#3219 <https://github.com/pybind/pybind11/pull/3219>`_ 766 767 * Avoid evaluating ``PYBIND11_TLS_REPLACE_VALUE`` arguments more than once. 768 `#3290 <https://github.com/pybind/pybind11/pull/3290>`_ 769 770 Fixes: 771 772 * Bug fix: enum value's ``__int__`` returning non-int when underlying type is 773 bool or of char type. 774 `#1334 <https://github.com/pybind/pybind11/pull/1334>`_ 775 776 * Fixes bug in setting error state in Capsule's pointer methods. 777 `#3261 <https://github.com/pybind/pybind11/pull/3261>`_ 778 779 * A long-standing memory leak in ``py::cpp_function::initialize`` was fixed. 780 `#3229 <https://github.com/pybind/pybind11/pull/3229>`_ 781 782 * Fixes thread safety for some ``pybind11::type_caster`` which require lifetime 783 extension, such as for ``std::string_view``. 784 `#3237 <https://github.com/pybind/pybind11/pull/3237>`_ 785 786 * Restore compatibility with gcc 4.8.4 as distributed by ubuntu-trusty, linuxmint-17. 787 `#3270 <https://github.com/pybind/pybind11/pull/3270>`_ 788 789 790 Build system improvements: 791 792 * Fix regression in CMake Python package config: improper use of absolute path. 793 `#3144 <https://github.com/pybind/pybind11/pull/3144>`_ 794 795 * Cached Python version information could become stale when CMake was re-run 796 with a different Python version. The build system now detects this and 797 updates this information. 798 `#3299 <https://github.com/pybind/pybind11/pull/3299>`_ 799 800 * Specified UTF8-encoding in setup.py calls of open(). 801 `#3137 <https://github.com/pybind/pybind11/pull/3137>`_ 802 803 * Fix a harmless warning from CMake 3.21 with the classic Python discovery. 804 `#3220 <https://github.com/pybind/pybind11/pull/3220>`_ 805 806 * Eigen repo and version can now be specified as cmake options. 807 `#3324 <https://github.com/pybind/pybind11/pull/3324>`_ 808 809 810 Backend and tidying up: 811 812 * Reduced thread-local storage required for keeping alive temporary data for 813 type conversion to one key per ABI version, rather than one key per extension 814 module. This makes the total thread-local storage required by pybind11 2 815 keys per ABI version. 816 `#3275 <https://github.com/pybind/pybind11/pull/3275>`_ 817 818 * Optimize NumPy array construction with additional moves. 819 `#3183 <https://github.com/pybind/pybind11/pull/3183>`_ 820 821 * Conversion to ``std::string`` and ``std::string_view`` now avoids making an 822 extra copy of the data on Python >= 3.3. 823 `#3257 <https://github.com/pybind/pybind11/pull/3257>`_ 824 825 * Remove const modifier from certain C++ methods on Python collections 826 (``list``, ``set``, ``dict``) such as (``clear()``, ``append()``, 827 ``insert()``, etc...) and annotated them with ``py-non-const``. 828 829 * Enable readability ``clang-tidy-const-return`` and remove useless consts. 830 `#3254 <https://github.com/pybind/pybind11/pull/3254>`_ 831 `#3194 <https://github.com/pybind/pybind11/pull/3194>`_ 832 833 * The clang-tidy ``google-explicit-constructor`` option was enabled. 834 `#3250 <https://github.com/pybind/pybind11/pull/3250>`_ 835 836 * Mark a pytype move constructor as noexcept (perf). 837 `#3236 <https://github.com/pybind/pybind11/pull/3236>`_ 838 839 * Enable clang-tidy check to guard against inheritance slicing. 840 `#3210 <https://github.com/pybind/pybind11/pull/3210>`_ 841 842 * Legacy warning suppression pragma were removed from eigen.h. On Unix 843 platforms, please use -isystem for Eigen include directories, to suppress 844 compiler warnings originating from Eigen headers. Note that CMake does this 845 by default. No adjustments are needed for Windows. 846 `#3198 <https://github.com/pybind/pybind11/pull/3198>`_ 847 848 * Format pybind11 with isort consistent ordering of imports 849 `#3195 <https://github.com/pybind/pybind11/pull/3195>`_ 850 851 * The warnings-suppression "pragma clamp" at the top/bottom of pybind11 was 852 removed, clearing the path to refactoring and IWYU cleanup. 853 `#3186 <https://github.com/pybind/pybind11/pull/3186>`_ 854 855 * Enable most bugprone checks in clang-tidy and fix the found potential bugs 856 and poor coding styles. 857 `#3166 <https://github.com/pybind/pybind11/pull/3166>`_ 858 859 * Add ``clang-tidy-readability`` rules to make boolean casts explicit improving 860 code readability. Also enabled other misc and readability clang-tidy checks. 861 `#3148 <https://github.com/pybind/pybind11/pull/3148>`_ 862 863 * Move object in ``.pop()`` for list. 864 `#3116 <https://github.com/pybind/pybind11/pull/3116>`_ 865 866 867 868 869 v2.7.1 (Aug 3, 2021) 870 --------------------- 871 872 Minor missing functionality added: 873 874 * Allow Python builtins to be used as callbacks in CPython. 875 `#1413 <https://github.com/pybind/pybind11/pull/1413>`_ 876 877 Bug fixes: 878 879 * Fix regression in CMake Python package config: improper use of absolute path. 880 `#3144 <https://github.com/pybind/pybind11/pull/3144>`_ 881 882 * Fix Mingw64 and add to the CI testing matrix. 883 `#3132 <https://github.com/pybind/pybind11/pull/3132>`_ 884 885 * Specified UTF8-encoding in setup.py calls of open(). 886 `#3137 <https://github.com/pybind/pybind11/pull/3137>`_ 887 888 * Add clang-tidy-readability rules to make boolean casts explicit improving 889 code readability. Also enabled other misc and readability clang-tidy checks. 890 `#3148 <https://github.com/pybind/pybind11/pull/3148>`_ 891 892 * Move object in ``.pop()`` for list. 893 `#3116 <https://github.com/pybind/pybind11/pull/3116>`_ 894 895 Backend and tidying up: 896 897 * Removed and fixed warning suppressions. 898 `#3127 <https://github.com/pybind/pybind11/pull/3127>`_ 899 `#3129 <https://github.com/pybind/pybind11/pull/3129>`_ 900 `#3135 <https://github.com/pybind/pybind11/pull/3135>`_ 901 `#3141 <https://github.com/pybind/pybind11/pull/3141>`_ 902 `#3142 <https://github.com/pybind/pybind11/pull/3142>`_ 903 `#3150 <https://github.com/pybind/pybind11/pull/3150>`_ 904 `#3152 <https://github.com/pybind/pybind11/pull/3152>`_ 905 `#3160 <https://github.com/pybind/pybind11/pull/3160>`_ 906 `#3161 <https://github.com/pybind/pybind11/pull/3161>`_ 907 908 909 v2.7.0 (Jul 16, 2021) 910 --------------------- 911 912 New features: 913 914 * Enable ``py::implicitly_convertible<py::none, ...>`` for 915 ``py::class_``-wrapped types. 916 `#3059 <https://github.com/pybind/pybind11/pull/3059>`_ 917 918 * Allow function pointer extraction from overloaded functions. 919 `#2944 <https://github.com/pybind/pybind11/pull/2944>`_ 920 921 * NumPy: added ``.char_()`` to type which gives the NumPy public ``char`` 922 result, which also distinguishes types by bit length (unlike ``.kind()``). 923 `#2864 <https://github.com/pybind/pybind11/pull/2864>`_ 924 925 * Add ``pybind11::bytearray`` to manipulate ``bytearray`` similar to ``bytes``. 926 `#2799 <https://github.com/pybind/pybind11/pull/2799>`_ 927 928 * ``pybind11/stl/filesystem.h`` registers a type caster that, on C++17/Python 929 3.6+, converts ``std::filesystem::path`` to ``pathlib.Path`` and any 930 ``os.PathLike`` to ``std::filesystem::path``. 931 `#2730 <https://github.com/pybind/pybind11/pull/2730>`_ 932 933 * A ``PYBIND11_VERSION_HEX`` define was added, similar to ``PY_VERSION_HEX``. 934 `#3120 <https://github.com/pybind/pybind11/pull/3120>`_ 935 936 937 938 Changes: 939 940 * ``py::str`` changed to exclusively hold ``PyUnicodeObject``. Previously 941 ``py::str`` could also hold ``bytes``, which is probably surprising, was 942 never documented, and can mask bugs (e.g. accidental use of ``py::str`` 943 instead of ``py::bytes``). 944 `#2409 <https://github.com/pybind/pybind11/pull/2409>`_ 945 946 * Add a safety guard to ensure that the Python GIL is held when C++ calls back 947 into Python via ``object_api<>::operator()`` (e.g. ``py::function`` 948 ``__call__``). (This feature is available for Python 3.6+ only.) 949 `#2919 <https://github.com/pybind/pybind11/pull/2919>`_ 950 951 * Catch a missing ``self`` argument in calls to ``__init__()``. 952 `#2914 <https://github.com/pybind/pybind11/pull/2914>`_ 953 954 * Use ``std::string_view`` if available to avoid a copy when passing an object 955 to a ``std::ostream``. 956 `#3042 <https://github.com/pybind/pybind11/pull/3042>`_ 957 958 * An important warning about thread safety was added to the ``iostream.h`` 959 documentation; attempts to make ``py::scoped_ostream_redirect`` thread safe 960 have been removed, as it was only partially effective. 961 `#2995 <https://github.com/pybind/pybind11/pull/2995>`_ 962 963 964 Fixes: 965 966 * Performance: avoid unnecessary strlen calls. 967 `#3058 <https://github.com/pybind/pybind11/pull/3058>`_ 968 969 * Fix auto-generated documentation string when using ``const T`` in 970 ``pyarray_t``. 971 `#3020 <https://github.com/pybind/pybind11/pull/3020>`_ 972 973 * Unify error messages thrown by ``simple_collector``/``unpacking_collector``. 974 `#3013 <https://github.com/pybind/pybind11/pull/3013>`_ 975 976 * ``pybind11::builtin_exception`` is now explicitly exported, which means the 977 types included/defined in different modules are identical, and exceptions 978 raised in different modules can be caught correctly. The documentation was 979 updated to explain that custom exceptions that are used across module 980 boundaries need to be explicitly exported as well. 981 `#2999 <https://github.com/pybind/pybind11/pull/2999>`_ 982 983 * Fixed exception when printing UTF-8 to a ``scoped_ostream_redirect``. 984 `#2982 <https://github.com/pybind/pybind11/pull/2982>`_ 985 986 * Pickle support enhancement: ``setstate`` implementation will attempt to 987 ``setattr`` ``__dict__`` only if the unpickled ``dict`` object is not empty, 988 to not force use of ``py::dynamic_attr()`` unnecessarily. 989 `#2972 <https://github.com/pybind/pybind11/pull/2972>`_ 990 991 * Allow negative timedelta values to roundtrip. 992 `#2870 <https://github.com/pybind/pybind11/pull/2870>`_ 993 994 * Fix unchecked errors could potentially swallow signals/other exceptions. 995 `#2863 <https://github.com/pybind/pybind11/pull/2863>`_ 996 997 * Add null pointer check with ``std::localtime``. 998 `#2846 <https://github.com/pybind/pybind11/pull/2846>`_ 999 1000 * Fix the ``weakref`` constructor from ``py::object`` to create a new 1001 ``weakref`` on conversion. 1002 `#2832 <https://github.com/pybind/pybind11/pull/2832>`_ 1003 1004 * Avoid relying on exceptions in C++17 when getting a ``shared_ptr`` holder 1005 from a ``shared_from_this`` class. 1006 `#2819 <https://github.com/pybind/pybind11/pull/2819>`_ 1007 1008 * Allow the codec's exception to be raised instead of :code:`RuntimeError` when 1009 casting from :code:`py::str` to :code:`std::string`. 1010 `#2903 <https://github.com/pybind/pybind11/pull/2903>`_ 1011 1012 1013 Build system improvements: 1014 1015 * In ``setup_helpers.py``, test for platforms that have some multiprocessing 1016 features but lack semaphores, which ``ParallelCompile`` requires. 1017 `#3043 <https://github.com/pybind/pybind11/pull/3043>`_ 1018 1019 * Fix ``pybind11_INCLUDE_DIR`` in case ``CMAKE_INSTALL_INCLUDEDIR`` is 1020 absolute. 1021 `#3005 <https://github.com/pybind/pybind11/pull/3005>`_ 1022 1023 * Fix bug not respecting ``WITH_SOABI`` or ``WITHOUT_SOABI`` to CMake. 1024 `#2938 <https://github.com/pybind/pybind11/pull/2938>`_ 1025 1026 * Fix the default ``Pybind11Extension`` compilation flags with a Mingw64 python. 1027 `#2921 <https://github.com/pybind/pybind11/pull/2921>`_ 1028 1029 * Clang on Windows: do not pass ``/MP`` (ignored flag). 1030 `#2824 <https://github.com/pybind/pybind11/pull/2824>`_ 1031 1032 * ``pybind11.setup_helpers.intree_extensions`` can be used to generate 1033 ``Pybind11Extension`` instances from cpp files placed in the Python package 1034 source tree. 1035 `#2831 <https://github.com/pybind/pybind11/pull/2831>`_ 1036 1037 Backend and tidying up: 1038 1039 * Enable clang-tidy performance, readability, and modernization checks 1040 throughout the codebase to enforce best coding practices. 1041 `#3046 <https://github.com/pybind/pybind11/pull/3046>`_, 1042 `#3049 <https://github.com/pybind/pybind11/pull/3049>`_, 1043 `#3051 <https://github.com/pybind/pybind11/pull/3051>`_, 1044 `#3052 <https://github.com/pybind/pybind11/pull/3052>`_, 1045 `#3080 <https://github.com/pybind/pybind11/pull/3080>`_, and 1046 `#3094 <https://github.com/pybind/pybind11/pull/3094>`_ 1047 1048 1049 * Checks for common misspellings were added to the pre-commit hooks. 1050 `#3076 <https://github.com/pybind/pybind11/pull/3076>`_ 1051 1052 * Changed ``Werror`` to stricter ``Werror-all`` for Intel compiler and fixed 1053 minor issues. 1054 `#2948 <https://github.com/pybind/pybind11/pull/2948>`_ 1055 1056 * Fixed compilation with GCC < 5 when the user defines ``_GLIBCXX_USE_CXX11_ABI``. 1057 `#2956 <https://github.com/pybind/pybind11/pull/2956>`_ 1058 1059 * Added nox support for easier local testing and linting of contributions. 1060 `#3101 <https://github.com/pybind/pybind11/pull/3101>`_ and 1061 `#3121 <https://github.com/pybind/pybind11/pull/3121>`_ 1062 1063 * Avoid RTD style issue with docutils 0.17+. 1064 `#3119 <https://github.com/pybind/pybind11/pull/3119>`_ 1065 1066 * Support pipx run, such as ``pipx run pybind11 --include`` for a quick compile. 1067 `#3117 <https://github.com/pybind/pybind11/pull/3117>`_ 1068 1069 1070 1071 v2.6.2 (Jan 26, 2021) 1072 --------------------- 1073 1074 Minor missing functionality added: 1075 1076 * enum: add missing Enum.value property. 1077 `#2739 <https://github.com/pybind/pybind11/pull/2739>`_ 1078 1079 * Allow thread termination to be avoided during shutdown for CPython 3.7+ via 1080 ``.disarm`` for ``gil_scoped_acquire``/``gil_scoped_release``. 1081 `#2657 <https://github.com/pybind/pybind11/pull/2657>`_ 1082 1083 Fixed or improved behavior in a few special cases: 1084 1085 * Fix bug where the constructor of ``object`` subclasses would not throw on 1086 being passed a Python object of the wrong type. 1087 `#2701 <https://github.com/pybind/pybind11/pull/2701>`_ 1088 1089 * The ``type_caster`` for integers does not convert Python objects with 1090 ``__int__`` anymore with ``noconvert`` or during the first round of trying 1091 overloads. 1092 `#2698 <https://github.com/pybind/pybind11/pull/2698>`_ 1093 1094 * When casting to a C++ integer, ``__index__`` is always called and not 1095 considered as conversion, consistent with Python 3.8+. 1096 `#2801 <https://github.com/pybind/pybind11/pull/2801>`_ 1097 1098 Build improvements: 1099 1100 * Setup helpers: ``extra_compile_args`` and ``extra_link_args`` automatically set by 1101 Pybind11Extension are now prepended, which allows them to be overridden 1102 by user-set ``extra_compile_args`` and ``extra_link_args``. 1103 `#2808 <https://github.com/pybind/pybind11/pull/2808>`_ 1104 1105 * Setup helpers: Don't trigger unused parameter warning. 1106 `#2735 <https://github.com/pybind/pybind11/pull/2735>`_ 1107 1108 * CMake: Support running with ``--warn-uninitialized`` active. 1109 `#2806 <https://github.com/pybind/pybind11/pull/2806>`_ 1110 1111 * CMake: Avoid error if included from two submodule directories. 1112 `#2804 <https://github.com/pybind/pybind11/pull/2804>`_ 1113 1114 * CMake: Fix ``STATIC`` / ``SHARED`` being ignored in FindPython mode. 1115 `#2796 <https://github.com/pybind/pybind11/pull/2796>`_ 1116 1117 * CMake: Respect the setting for ``CMAKE_CXX_VISIBILITY_PRESET`` if defined. 1118 `#2793 <https://github.com/pybind/pybind11/pull/2793>`_ 1119 1120 * CMake: Fix issue with FindPython2/FindPython3 not working with ``pybind11::embed``. 1121 `#2662 <https://github.com/pybind/pybind11/pull/2662>`_ 1122 1123 * CMake: mixing local and installed pybind11's would prioritize the installed 1124 one over the local one (regression in 2.6.0). 1125 `#2716 <https://github.com/pybind/pybind11/pull/2716>`_ 1126 1127 1128 Bug fixes: 1129 1130 * Fixed segfault in multithreaded environments when using 1131 ``scoped_ostream_redirect``. 1132 `#2675 <https://github.com/pybind/pybind11/pull/2675>`_ 1133 1134 * Leave docstring unset when all docstring-related options are disabled, rather 1135 than set an empty string. 1136 `#2745 <https://github.com/pybind/pybind11/pull/2745>`_ 1137 1138 * The module key in builtins that pybind11 uses to store its internals changed 1139 from std::string to a python str type (more natural on Python 2, no change on 1140 Python 3). 1141 `#2814 <https://github.com/pybind/pybind11/pull/2814>`_ 1142 1143 * Fixed assertion error related to unhandled (later overwritten) exception in 1144 CPython 3.8 and 3.9 debug builds. 1145 `#2685 <https://github.com/pybind/pybind11/pull/2685>`_ 1146 1147 * Fix ``py::gil_scoped_acquire`` assert with CPython 3.9 debug build. 1148 `#2683 <https://github.com/pybind/pybind11/pull/2683>`_ 1149 1150 * Fix issue with a test failing on pytest 6.2. 1151 `#2741 <https://github.com/pybind/pybind11/pull/2741>`_ 1152 1153 Warning fixes: 1154 1155 * Fix warning modifying constructor parameter 'flag' that shadows a field of 1156 'set_flag' ``[-Wshadow-field-in-constructor-modified]``. 1157 `#2780 <https://github.com/pybind/pybind11/pull/2780>`_ 1158 1159 * Suppressed some deprecation warnings about old-style 1160 ``__init__``/``__setstate__`` in the tests. 1161 `#2759 <https://github.com/pybind/pybind11/pull/2759>`_ 1162 1163 Valgrind work: 1164 1165 * Fix invalid access when calling a pybind11 ``__init__`` on a non-pybind11 1166 class instance. 1167 `#2755 <https://github.com/pybind/pybind11/pull/2755>`_ 1168 1169 * Fixed various minor memory leaks in pybind11's test suite. 1170 `#2758 <https://github.com/pybind/pybind11/pull/2758>`_ 1171 1172 * Resolved memory leak in cpp_function initialization when exceptions occurred. 1173 `#2756 <https://github.com/pybind/pybind11/pull/2756>`_ 1174 1175 * Added a Valgrind build, checking for leaks and memory-related UB, to CI. 1176 `#2746 <https://github.com/pybind/pybind11/pull/2746>`_ 1177 1178 Compiler support: 1179 1180 * Intel compiler was not activating C++14 support due to a broken define. 1181 `#2679 <https://github.com/pybind/pybind11/pull/2679>`_ 1182 1183 * Support ICC and NVIDIA HPC SDK in C++17 mode. 1184 `#2729 <https://github.com/pybind/pybind11/pull/2729>`_ 1185 1186 * Support Intel OneAPI compiler (ICC 20.2) and add to CI. 1187 `#2573 <https://github.com/pybind/pybind11/pull/2573>`_ 1188 1189 1190 1191 v2.6.1 (Nov 11, 2020) 1192 --------------------- 1193 1194 * ``py::exec``, ``py::eval``, and ``py::eval_file`` now add the builtins module 1195 as ``"__builtins__"`` to their ``globals`` argument, better matching ``exec`` 1196 and ``eval`` in pure Python. 1197 `#2616 <https://github.com/pybind/pybind11/pull/2616>`_ 1198 1199 * ``setup_helpers`` will no longer set a minimum macOS version higher than the 1200 current version. 1201 `#2622 <https://github.com/pybind/pybind11/pull/2622>`_ 1202 1203 * Allow deleting static properties. 1204 `#2629 <https://github.com/pybind/pybind11/pull/2629>`_ 1205 1206 * Seal a leak in ``def_buffer``, cleaning up the ``capture`` object after the 1207 ``class_`` object goes out of scope. 1208 `#2634 <https://github.com/pybind/pybind11/pull/2634>`_ 1209 1210 * ``pybind11_INCLUDE_DIRS`` was incorrect, potentially causing a regression if 1211 it was expected to include ``PYTHON_INCLUDE_DIRS`` (please use targets 1212 instead). 1213 `#2636 <https://github.com/pybind/pybind11/pull/2636>`_ 1214 1215 * Added parameter names to the ``py::enum_`` constructor and methods, avoiding 1216 ``arg0`` in the generated docstrings. 1217 `#2637 <https://github.com/pybind/pybind11/pull/2637>`_ 1218 1219 * Added ``needs_recompile`` optional function to the ``ParallelCompiler`` 1220 helper, to allow a recompile to be skipped based on a user-defined function. 1221 `#2643 <https://github.com/pybind/pybind11/pull/2643>`_ 1222 1223 1224 v2.6.0 (Oct 21, 2020) 1225 --------------------- 1226 1227 See :ref:`upgrade-guide-2.6` for help upgrading to the new version. 1228 1229 New features: 1230 1231 * Keyword-only arguments supported in Python 2 or 3 with ``py::kw_only()``. 1232 `#2100 <https://github.com/pybind/pybind11/pull/2100>`_ 1233 1234 * Positional-only arguments supported in Python 2 or 3 with ``py::pos_only()``. 1235 `#2459 <https://github.com/pybind/pybind11/pull/2459>`_ 1236 1237 * ``py::is_final()`` class modifier to block subclassing (CPython only). 1238 `#2151 <https://github.com/pybind/pybind11/pull/2151>`_ 1239 1240 * Added ``py::prepend()``, allowing a function to be placed at the beginning of 1241 the overload chain. 1242 `#1131 <https://github.com/pybind/pybind11/pull/1131>`_ 1243 1244 * Access to the type object now provided with ``py::type::of<T>()`` and 1245 ``py::type::of(h)``. 1246 `#2364 <https://github.com/pybind/pybind11/pull/2364>`_ 1247 1248 * Perfect forwarding support for methods. 1249 `#2048 <https://github.com/pybind/pybind11/pull/2048>`_ 1250 1251 * Added ``py::error_already_set::discard_as_unraisable()``. 1252 `#2372 <https://github.com/pybind/pybind11/pull/2372>`_ 1253 1254 * ``py::hash`` is now public. 1255 `#2217 <https://github.com/pybind/pybind11/pull/2217>`_ 1256 1257 * ``py::class_<union_type>`` is now supported. Note that writing to one data 1258 member of the union and reading another (type punning) is UB in C++. Thus 1259 pybind11-bound enums should never be used for such conversions. 1260 `#2320 <https://github.com/pybind/pybind11/pull/2320>`_. 1261 1262 * Classes now check local scope when registering members, allowing a subclass 1263 to have a member with the same name as a parent (such as an enum). 1264 `#2335 <https://github.com/pybind/pybind11/pull/2335>`_ 1265 1266 Code correctness features: 1267 1268 * Error now thrown when ``__init__`` is forgotten on subclasses. 1269 `#2152 <https://github.com/pybind/pybind11/pull/2152>`_ 1270 1271 * Throw error if conversion to a pybind11 type if the Python object isn't a 1272 valid instance of that type, such as ``py::bytes(o)`` when ``py::object o`` 1273 isn't a bytes instance. 1274 `#2349 <https://github.com/pybind/pybind11/pull/2349>`_ 1275 1276 * Throw if conversion to ``str`` fails. 1277 `#2477 <https://github.com/pybind/pybind11/pull/2477>`_ 1278 1279 1280 API changes: 1281 1282 * ``py::module`` was renamed ``py::module_`` to avoid issues with C++20 when 1283 used unqualified, but an alias ``py::module`` is provided for backward 1284 compatibility. 1285 `#2489 <https://github.com/pybind/pybind11/pull/2489>`_ 1286 1287 * Public constructors for ``py::module_`` have been deprecated; please use 1288 ``pybind11::module_::create_extension_module`` if you were using the public 1289 constructor (fairly rare after ``PYBIND11_MODULE`` was introduced). 1290 `#2552 <https://github.com/pybind/pybind11/pull/2552>`_ 1291 1292 * ``PYBIND11_OVERLOAD*`` macros and ``get_overload`` function replaced by 1293 correctly-named ``PYBIND11_OVERRIDE*`` and ``get_override``, fixing 1294 inconsistencies in the presence of a closing ``;`` in these macros. 1295 ``get_type_overload`` is deprecated. 1296 `#2325 <https://github.com/pybind/pybind11/pull/2325>`_ 1297 1298 Packaging / building improvements: 1299 1300 * The Python package was reworked to be more powerful and useful. 1301 `#2433 <https://github.com/pybind/pybind11/pull/2433>`_ 1302 1303 * :ref:`build-setuptools` is easier thanks to a new 1304 ``pybind11.setup_helpers`` module, which provides utilities to use 1305 setuptools with pybind11. It can be used via PEP 518, ``setup_requires``, 1306 or by directly importing or copying ``setup_helpers.py`` into your project. 1307 1308 * CMake configuration files are now included in the Python package. Use 1309 ``pybind11.get_cmake_dir()`` or ``python -m pybind11 --cmakedir`` to get 1310 the directory with the CMake configuration files, or include the 1311 site-packages location in your ``CMAKE_MODULE_PATH``. Or you can use the 1312 new ``pybind11[global]`` extra when you install ``pybind11``, which 1313 installs the CMake files and headers into your base environment in the 1314 standard location. 1315 1316 * ``pybind11-config`` is another way to write ``python -m pybind11`` if you 1317 have your PATH set up. 1318 1319 * Added external typing support to the helper module, code from 1320 ``import pybind11`` can now be type checked. 1321 `#2588 <https://github.com/pybind/pybind11/pull/2588>`_ 1322 1323 * Minimum CMake required increased to 3.4. 1324 `#2338 <https://github.com/pybind/pybind11/pull/2338>`_ and 1325 `#2370 <https://github.com/pybind/pybind11/pull/2370>`_ 1326 1327 * Full integration with CMake's C++ standard system and compile features 1328 replaces ``PYBIND11_CPP_STANDARD``. 1329 1330 * Generated config file is now portable to different Python/compiler/CMake 1331 versions. 1332 1333 * Virtual environments prioritized if ``PYTHON_EXECUTABLE`` is not set 1334 (``venv``, ``virtualenv``, and ``conda``) (similar to the new FindPython 1335 mode). 1336 1337 * Other CMake features now natively supported, like 1338 ``CMAKE_INTERPROCEDURAL_OPTIMIZATION``, ``set(CMAKE_CXX_VISIBILITY_PRESET 1339 hidden)``. 1340 1341 * ``CUDA`` as a language is now supported. 1342 1343 * Helper functions ``pybind11_strip``, ``pybind11_extension``, 1344 ``pybind11_find_import`` added, see :doc:`cmake/index`. 1345 1346 * Optional :ref:`find-python-mode` and :ref:`nopython-mode` with CMake. 1347 `#2370 <https://github.com/pybind/pybind11/pull/2370>`_ 1348 1349 * Uninstall target added. 1350 `#2265 <https://github.com/pybind/pybind11/pull/2265>`_ and 1351 `#2346 <https://github.com/pybind/pybind11/pull/2346>`_ 1352 1353 * ``pybind11_add_module()`` now accepts an optional ``OPT_SIZE`` flag that 1354 switches the binding target to size-based optimization if the global build 1355 type can not always be fixed to ``MinSizeRel`` (except in debug mode, where 1356 optimizations remain disabled). ``MinSizeRel`` or this flag reduces binary 1357 size quite substantially (~25% on some platforms). 1358 `#2463 <https://github.com/pybind/pybind11/pull/2463>`_ 1359 1360 Smaller or developer focused features and fixes: 1361 1362 * Moved ``mkdoc.py`` to a new repo, `pybind11-mkdoc`_. There are no longer 1363 submodules in the main repo. 1364 1365 * ``py::memoryview`` segfault fix and update, with new 1366 ``py::memoryview::from_memory`` in Python 3, and documentation. 1367 `#2223 <https://github.com/pybind/pybind11/pull/2223>`_ 1368 1369 * Fix for ``buffer_info`` on Python 2. 1370 `#2503 <https://github.com/pybind/pybind11/pull/2503>`_ 1371 1372 * If ``__eq__`` defined but not ``__hash__``, ``__hash__`` is now set to 1373 ``None``. 1374 `#2291 <https://github.com/pybind/pybind11/pull/2291>`_ 1375 1376 * ``py::ellipsis`` now also works on Python 2. 1377 `#2360 <https://github.com/pybind/pybind11/pull/2360>`_ 1378 1379 * Pointer to ``std::tuple`` & ``std::pair`` supported in cast. 1380 `#2334 <https://github.com/pybind/pybind11/pull/2334>`_ 1381 1382 * Small fixes in NumPy support. ``py::array`` now uses ``py::ssize_t`` as first 1383 argument type. 1384 `#2293 <https://github.com/pybind/pybind11/pull/2293>`_ 1385 1386 * Added missing signature for ``py::array``. 1387 `#2363 <https://github.com/pybind/pybind11/pull/2363>`_ 1388 1389 * ``unchecked_mutable_reference`` has access to operator ``()`` and ``[]`` when 1390 const. 1391 `#2514 <https://github.com/pybind/pybind11/pull/2514>`_ 1392 1393 * ``py::vectorize`` is now supported on functions that return void. 1394 `#1969 <https://github.com/pybind/pybind11/pull/1969>`_ 1395 1396 * ``py::capsule`` supports ``get_pointer`` and ``set_pointer``. 1397 `#1131 <https://github.com/pybind/pybind11/pull/1131>`_ 1398 1399 * Fix crash when different instances share the same pointer of the same type. 1400 `#2252 <https://github.com/pybind/pybind11/pull/2252>`_ 1401 1402 * Fix for ``py::len`` not clearing Python's error state when it fails and throws. 1403 `#2575 <https://github.com/pybind/pybind11/pull/2575>`_ 1404 1405 * Bugfixes related to more extensive testing, new GitHub Actions CI. 1406 `#2321 <https://github.com/pybind/pybind11/pull/2321>`_ 1407 1408 * Bug in timezone issue in Eastern hemisphere midnight fixed. 1409 `#2438 <https://github.com/pybind/pybind11/pull/2438>`_ 1410 1411 * ``std::chrono::time_point`` now works when the resolution is not the same as 1412 the system. 1413 `#2481 <https://github.com/pybind/pybind11/pull/2481>`_ 1414 1415 * Bug fixed where ``py::array_t`` could accept arrays that did not match the 1416 requested ordering. 1417 `#2484 <https://github.com/pybind/pybind11/pull/2484>`_ 1418 1419 * Avoid a segfault on some compilers when types are removed in Python. 1420 `#2564 <https://github.com/pybind/pybind11/pull/2564>`_ 1421 1422 * ``py::arg::none()`` is now also respected when passing keyword arguments. 1423 `#2611 <https://github.com/pybind/pybind11/pull/2611>`_ 1424 1425 * PyPy fixes, PyPy 7.3.x now supported, including PyPy3. (Known issue with 1426 PyPy2 and Windows `#2596 <https://github.com/pybind/pybind11/issues/2596>`_). 1427 `#2146 <https://github.com/pybind/pybind11/pull/2146>`_ 1428 1429 * CPython 3.9.0 workaround for undefined behavior (macOS segfault). 1430 `#2576 <https://github.com/pybind/pybind11/pull/2576>`_ 1431 1432 * CPython 3.9 warning fixes. 1433 `#2253 <https://github.com/pybind/pybind11/pull/2253>`_ 1434 1435 * Improved C++20 support, now tested in CI. 1436 `#2489 <https://github.com/pybind/pybind11/pull/2489>`_ 1437 `#2599 <https://github.com/pybind/pybind11/pull/2599>`_ 1438 1439 * Improved but still incomplete debug Python interpreter support. 1440 `#2025 <https://github.com/pybind/pybind11/pull/2025>`_ 1441 1442 * NVCC (CUDA 11) now supported and tested in CI. 1443 `#2461 <https://github.com/pybind/pybind11/pull/2461>`_ 1444 1445 * NVIDIA PGI compilers now supported and tested in CI. 1446 `#2475 <https://github.com/pybind/pybind11/pull/2475>`_ 1447 1448 * At least Intel 18 now explicitly required when compiling with Intel. 1449 `#2577 <https://github.com/pybind/pybind11/pull/2577>`_ 1450 1451 * Extensive style checking in CI, with `pre-commit`_ support. Code 1452 modernization, checked by clang-tidy. 1453 1454 * Expanded docs, including new main page, new installing section, and CMake 1455 helpers page, along with over a dozen new sections on existing pages. 1456 1457 * In GitHub, new docs for contributing and new issue templates. 1458 1459 .. _pre-commit: https://pre-commit.com 1460 1461 .. _pybind11-mkdoc: https://github.com/pybind/pybind11-mkdoc 1462 1463 v2.5.0 (Mar 31, 2020) 1464 ----------------------------------------------------- 1465 1466 * Use C++17 fold expressions in type casters, if available. This can 1467 improve performance during overload resolution when functions have 1468 multiple arguments. 1469 `#2043 <https://github.com/pybind/pybind11/pull/2043>`_. 1470 1471 * Changed include directory resolution in ``pybind11/__init__.py`` 1472 and installation in ``setup.py``. This fixes a number of open issues 1473 where pybind11 headers could not be found in certain environments. 1474 `#1995 <https://github.com/pybind/pybind11/pull/1995>`_. 1475 1476 * C++20 ``char8_t`` and ``u8string`` support. `#2026 1477 <https://github.com/pybind/pybind11/pull/2026>`_. 1478 1479 * CMake: search for Python 3.9. `bb9c91 1480 <https://github.com/pybind/pybind11/commit/bb9c91>`_. 1481 1482 * Fixes for MSYS-based build environments. 1483 `#2087 <https://github.com/pybind/pybind11/pull/2087>`_, 1484 `#2053 <https://github.com/pybind/pybind11/pull/2053>`_. 1485 1486 * STL bindings for ``std::vector<...>::clear``. `#2074 1487 <https://github.com/pybind/pybind11/pull/2074>`_. 1488 1489 * Read-only flag for ``py::buffer``. `#1466 1490 <https://github.com/pybind/pybind11/pull/1466>`_. 1491 1492 * Exception handling during module initialization. 1493 `bf2b031 <https://github.com/pybind/pybind11/commit/bf2b031>`_. 1494 1495 * Support linking against a CPython debug build. 1496 `#2025 <https://github.com/pybind/pybind11/pull/2025>`_. 1497 1498 * Fixed issues involving the availability and use of aligned ``new`` and 1499 ``delete``. `#1988 <https://github.com/pybind/pybind11/pull/1988>`_, 1500 `759221 <https://github.com/pybind/pybind11/commit/759221>`_. 1501 1502 * Fixed a resource leak upon interpreter shutdown. 1503 `#2020 <https://github.com/pybind/pybind11/pull/2020>`_. 1504 1505 * Fixed error handling in the boolean caster. 1506 `#1976 <https://github.com/pybind/pybind11/pull/1976>`_. 1507 1508 v2.4.3 (Oct 15, 2019) 1509 ----------------------------------------------------- 1510 1511 * Adapt pybind11 to a C API convention change in Python 3.8. `#1950 1512 <https://github.com/pybind/pybind11/pull/1950>`_. 1513 1514 v2.4.2 (Sep 21, 2019) 1515 ----------------------------------------------------- 1516 1517 * Replaced usage of a C++14 only construct. `#1929 1518 <https://github.com/pybind/pybind11/pull/1929>`_. 1519 1520 * Made an ifdef future-proof for Python >= 4. `f3109d 1521 <https://github.com/pybind/pybind11/commit/f3109d>`_. 1522 1523 v2.4.1 (Sep 20, 2019) 1524 ----------------------------------------------------- 1525 1526 * Fixed a problem involving implicit conversion from enumerations to integers 1527 on Python 3.8. `#1780 <https://github.com/pybind/pybind11/pull/1780>`_. 1528 1529 v2.4.0 (Sep 19, 2019) 1530 ----------------------------------------------------- 1531 1532 * Try harder to keep pybind11-internal data structures separate when there 1533 are potential ABI incompatibilities. Fixes crashes that occurred when loading 1534 multiple pybind11 extensions that were e.g. compiled by GCC (libstdc++) 1535 and Clang (libc++). 1536 `#1588 <https://github.com/pybind/pybind11/pull/1588>`_ and 1537 `c9f5a <https://github.com/pybind/pybind11/commit/c9f5a>`_. 1538 1539 * Added support for ``__await__``, ``__aiter__``, and ``__anext__`` protocols. 1540 `#1842 <https://github.com/pybind/pybind11/pull/1842>`_. 1541 1542 * ``pybind11_add_module()``: don't strip symbols when compiling in 1543 ``RelWithDebInfo`` mode. `#1980 1544 <https://github.com/pybind/pybind11/pull/1980>`_. 1545 1546 * ``enum_``: Reproduce Python behavior when comparing against invalid values 1547 (e.g. ``None``, strings, etc.). Add back support for ``__invert__()``. 1548 `#1912 <https://github.com/pybind/pybind11/pull/1912>`_, 1549 `#1907 <https://github.com/pybind/pybind11/pull/1907>`_. 1550 1551 * List insertion operation for ``py::list``. 1552 Added ``.empty()`` to all collection types. 1553 Added ``py::set::contains()`` and ``py::dict::contains()``. 1554 `#1887 <https://github.com/pybind/pybind11/pull/1887>`_, 1555 `#1884 <https://github.com/pybind/pybind11/pull/1884>`_, 1556 `#1888 <https://github.com/pybind/pybind11/pull/1888>`_. 1557 1558 * ``py::details::overload_cast_impl`` is available in C++11 mode, can be used 1559 like ``overload_cast`` with an additional set of parentheses. 1560 `#1581 <https://github.com/pybind/pybind11/pull/1581>`_. 1561 1562 * Fixed ``get_include()`` on Conda. 1563 `#1877 <https://github.com/pybind/pybind11/pull/1877>`_. 1564 1565 * ``stl_bind.h``: negative indexing support. 1566 `#1882 <https://github.com/pybind/pybind11/pull/1882>`_. 1567 1568 * Minor CMake fix to add MinGW compatibility. 1569 `#1851 <https://github.com/pybind/pybind11/pull/1851>`_. 1570 1571 * GIL-related fixes. 1572 `#1836 <https://github.com/pybind/pybind11/pull/1836>`_, 1573 `8b90b <https://github.com/pybind/pybind11/commit/8b90b>`_. 1574 1575 * Other very minor/subtle fixes and improvements. 1576 `#1329 <https://github.com/pybind/pybind11/pull/1329>`_, 1577 `#1910 <https://github.com/pybind/pybind11/pull/1910>`_, 1578 `#1863 <https://github.com/pybind/pybind11/pull/1863>`_, 1579 `#1847 <https://github.com/pybind/pybind11/pull/1847>`_, 1580 `#1890 <https://github.com/pybind/pybind11/pull/1890>`_, 1581 `#1860 <https://github.com/pybind/pybind11/pull/1860>`_, 1582 `#1848 <https://github.com/pybind/pybind11/pull/1848>`_, 1583 `#1821 <https://github.com/pybind/pybind11/pull/1821>`_, 1584 `#1837 <https://github.com/pybind/pybind11/pull/1837>`_, 1585 `#1833 <https://github.com/pybind/pybind11/pull/1833>`_, 1586 `#1748 <https://github.com/pybind/pybind11/pull/1748>`_, 1587 `#1852 <https://github.com/pybind/pybind11/pull/1852>`_. 1588 1589 v2.3.0 (June 11, 2019) 1590 ----------------------------------------------------- 1591 1592 * Significantly reduced module binary size (10-20%) when compiled in C++11 mode 1593 with GCC/Clang, or in any mode with MSVC. Function signatures are now always 1594 precomputed at compile time (this was previously only available in C++14 mode 1595 for non-MSVC compilers). 1596 `#934 <https://github.com/pybind/pybind11/pull/934>`_. 1597 1598 * Add basic support for tag-based static polymorphism, where classes 1599 provide a method to returns the desired type of an instance. 1600 `#1326 <https://github.com/pybind/pybind11/pull/1326>`_. 1601 1602 * Python type wrappers (``py::handle``, ``py::object``, etc.) 1603 now support map Python's number protocol onto C++ arithmetic 1604 operators such as ``operator+``, ``operator/=``, etc. 1605 `#1511 <https://github.com/pybind/pybind11/pull/1511>`_. 1606 1607 * A number of improvements related to enumerations: 1608 1609 1. The ``enum_`` implementation was rewritten from scratch to reduce 1610 code bloat. Rather than instantiating a full implementation for each 1611 enumeration, most code is now contained in a generic base class. 1612 `#1511 <https://github.com/pybind/pybind11/pull/1511>`_. 1613 1614 2. The ``value()`` method of ``py::enum_`` now accepts an optional 1615 docstring that will be shown in the documentation of the associated 1616 enumeration. `#1160 <https://github.com/pybind/pybind11/pull/1160>`_. 1617 1618 3. check for already existing enum value and throw an error if present. 1619 `#1453 <https://github.com/pybind/pybind11/pull/1453>`_. 1620 1621 * Support for over-aligned type allocation via C++17's aligned ``new`` 1622 statement. `#1582 <https://github.com/pybind/pybind11/pull/1582>`_. 1623 1624 * Added ``py::ellipsis()`` method for slicing of multidimensional NumPy arrays 1625 `#1502 <https://github.com/pybind/pybind11/pull/1502>`_. 1626 1627 * Numerous Improvements to the ``mkdoc.py`` script for extracting documentation 1628 from C++ header files. 1629 `#1788 <https://github.com/pybind/pybind11/pull/1788>`_. 1630 1631 * ``pybind11_add_module()``: allow including Python as a ``SYSTEM`` include path. 1632 `#1416 <https://github.com/pybind/pybind11/pull/1416>`_. 1633 1634 * ``pybind11/stl.h`` does not convert strings to ``vector<string>`` anymore. 1635 `#1258 <https://github.com/pybind/pybind11/issues/1258>`_. 1636 1637 * Mark static methods as such to fix auto-generated Sphinx documentation. 1638 `#1732 <https://github.com/pybind/pybind11/pull/1732>`_. 1639 1640 * Re-throw forced unwind exceptions (e.g. during pthread termination). 1641 `#1208 <https://github.com/pybind/pybind11/pull/1208>`_. 1642 1643 * Added ``__contains__`` method to the bindings of maps (``std::map``, 1644 ``std::unordered_map``). 1645 `#1767 <https://github.com/pybind/pybind11/pull/1767>`_. 1646 1647 * Improvements to ``gil_scoped_acquire``. 1648 `#1211 <https://github.com/pybind/pybind11/pull/1211>`_. 1649 1650 * Type caster support for ``std::deque<T>``. 1651 `#1609 <https://github.com/pybind/pybind11/pull/1609>`_. 1652 1653 * Support for ``std::unique_ptr`` holders, whose deleters differ between a base and derived 1654 class. `#1353 <https://github.com/pybind/pybind11/pull/1353>`_. 1655 1656 * Construction of STL array/vector-like data structures from 1657 iterators. Added an ``extend()`` operation. 1658 `#1709 <https://github.com/pybind/pybind11/pull/1709>`_, 1659 1660 * CMake build system improvements for projects that include non-C++ 1661 files (e.g. plain C, CUDA) in ``pybind11_add_module`` et al. 1662 `#1678 <https://github.com/pybind/pybind11/pull/1678>`_. 1663 1664 * Fixed asynchronous invocation and deallocation of Python functions 1665 wrapped in ``std::function``. 1666 `#1595 <https://github.com/pybind/pybind11/pull/1595>`_. 1667 1668 * Fixes regarding return value policy propagation in STL type casters. 1669 `#1603 <https://github.com/pybind/pybind11/pull/1603>`_. 1670 1671 * Fixed scoped enum comparisons. 1672 `#1571 <https://github.com/pybind/pybind11/pull/1571>`_. 1673 1674 * Fixed iostream redirection for code that releases the GIL. 1675 `#1368 <https://github.com/pybind/pybind11/pull/1368>`_, 1676 1677 * A number of CI-related fixes. 1678 `#1757 <https://github.com/pybind/pybind11/pull/1757>`_, 1679 `#1744 <https://github.com/pybind/pybind11/pull/1744>`_, 1680 `#1670 <https://github.com/pybind/pybind11/pull/1670>`_. 1681 1682 v2.2.4 (September 11, 2018) 1683 ----------------------------------------------------- 1684 1685 * Use new Python 3.7 Thread Specific Storage (TSS) implementation if available. 1686 `#1454 <https://github.com/pybind/pybind11/pull/1454>`_, 1687 `#1517 <https://github.com/pybind/pybind11/pull/1517>`_. 1688 1689 * Fixes for newer MSVC versions and C++17 mode. 1690 `#1347 <https://github.com/pybind/pybind11/pull/1347>`_, 1691 `#1462 <https://github.com/pybind/pybind11/pull/1462>`_. 1692 1693 * Propagate return value policies to type-specific casters 1694 when casting STL containers. 1695 `#1455 <https://github.com/pybind/pybind11/pull/1455>`_. 1696 1697 * Allow ostream-redirection of more than 1024 characters. 1698 `#1479 <https://github.com/pybind/pybind11/pull/1479>`_. 1699 1700 * Set ``Py_DEBUG`` define when compiling against a debug Python build. 1701 `#1438 <https://github.com/pybind/pybind11/pull/1438>`_. 1702 1703 * Untangle integer logic in number type caster to work for custom 1704 types that may only be castable to a restricted set of builtin types. 1705 `#1442 <https://github.com/pybind/pybind11/pull/1442>`_. 1706 1707 * CMake build system: Remember Python version in cache file. 1708 `#1434 <https://github.com/pybind/pybind11/pull/1434>`_. 1709 1710 * Fix for custom smart pointers: use ``std::addressof`` to obtain holder 1711 address instead of ``operator&``. 1712 `#1435 <https://github.com/pybind/pybind11/pull/1435>`_. 1713 1714 * Properly report exceptions thrown during module initialization. 1715 `#1362 <https://github.com/pybind/pybind11/pull/1362>`_. 1716 1717 * Fixed a segmentation fault when creating empty-shaped NumPy array. 1718 `#1371 <https://github.com/pybind/pybind11/pull/1371>`_. 1719 1720 * The version of Intel C++ compiler must be >= 2017, and this is now checked by 1721 the header files. `#1363 <https://github.com/pybind/pybind11/pull/1363>`_. 1722 1723 * A few minor typo fixes and improvements to the test suite, and 1724 patches that silence compiler warnings. 1725 1726 * Vectors now support construction from generators, as well as ``extend()`` from a 1727 list or generator. 1728 `#1496 <https://github.com/pybind/pybind11/pull/1496>`_. 1729 1730 1731 v2.2.3 (April 29, 2018) 1732 ----------------------------------------------------- 1733 1734 * The pybind11 header location detection was replaced by a new implementation 1735 that no longer depends on ``pip`` internals (the recently released ``pip`` 1736 10 has restricted access to this API). 1737 `#1190 <https://github.com/pybind/pybind11/pull/1190>`_. 1738 1739 * Small adjustment to an implementation detail to work around a compiler segmentation fault in Clang 3.3/3.4. 1740 `#1350 <https://github.com/pybind/pybind11/pull/1350>`_. 1741 1742 * The minimal supported version of the Intel compiler was >= 17.0 since 1743 pybind11 v2.1. This check is now explicit, and a compile-time error is raised 1744 if the compiler meet the requirement. 1745 `#1363 <https://github.com/pybind/pybind11/pull/1363>`_. 1746 1747 * Fixed an endianness-related fault in the test suite. 1748 `#1287 <https://github.com/pybind/pybind11/pull/1287>`_. 1749 1750 v2.2.2 (February 7, 2018) 1751 ----------------------------------------------------- 1752 1753 * Fixed a segfault when combining embedded interpreter 1754 shutdown/reinitialization with external loaded pybind11 modules. 1755 `#1092 <https://github.com/pybind/pybind11/pull/1092>`_. 1756 1757 * Eigen support: fixed a bug where Nx1/1xN numpy inputs couldn't be passed as 1758 arguments to Eigen vectors (which for Eigen are simply compile-time fixed 1759 Nx1/1xN matrices). 1760 `#1106 <https://github.com/pybind/pybind11/pull/1106>`_. 1761 1762 * Clarified to license by moving the licensing of contributions from 1763 ``LICENSE`` into ``CONTRIBUTING.md``: the licensing of contributions is not 1764 actually part of the software license as distributed. This isn't meant to be 1765 a substantial change in the licensing of the project, but addresses concerns 1766 that the clause made the license non-standard. 1767 `#1109 <https://github.com/pybind/pybind11/issues/1109>`_. 1768 1769 * Fixed a regression introduced in 2.1 that broke binding functions with lvalue 1770 character literal arguments. 1771 `#1128 <https://github.com/pybind/pybind11/pull/1128>`_. 1772 1773 * MSVC: fix for compilation failures under /permissive-, and added the flag to 1774 the appveyor test suite. 1775 `#1155 <https://github.com/pybind/pybind11/pull/1155>`_. 1776 1777 * Fixed ``__qualname__`` generation, and in turn, fixes how class names 1778 (especially nested class names) are shown in generated docstrings. 1779 `#1171 <https://github.com/pybind/pybind11/pull/1171>`_. 1780 1781 * Updated the FAQ with a suggested project citation reference. 1782 `#1189 <https://github.com/pybind/pybind11/pull/1189>`_. 1783 1784 * Added fixes for deprecation warnings when compiled under C++17 with 1785 ``-Wdeprecated`` turned on, and add ``-Wdeprecated`` to the test suite 1786 compilation flags. 1787 `#1191 <https://github.com/pybind/pybind11/pull/1191>`_. 1788 1789 * Fixed outdated PyPI URLs in ``setup.py``. 1790 `#1213 <https://github.com/pybind/pybind11/pull/1213>`_. 1791 1792 * Fixed a refcount leak for arguments that end up in a ``py::args`` argument 1793 for functions with both fixed positional and ``py::args`` arguments. 1794 `#1216 <https://github.com/pybind/pybind11/pull/1216>`_. 1795 1796 * Fixed a potential segfault resulting from possible premature destruction of 1797 ``py::args``/``py::kwargs`` arguments with overloaded functions. 1798 `#1223 <https://github.com/pybind/pybind11/pull/1223>`_. 1799 1800 * Fixed ``del map[item]`` for a ``stl_bind.h`` bound stl map. 1801 `#1229 <https://github.com/pybind/pybind11/pull/1229>`_. 1802 1803 * Fixed a regression from v2.1.x where the aggregate initialization could 1804 unintentionally end up at a constructor taking a templated 1805 ``std::initializer_list<T>`` argument. 1806 `#1249 <https://github.com/pybind/pybind11/pull/1249>`_. 1807 1808 * Fixed an issue where calling a function with a keep_alive policy on the same 1809 nurse/patient pair would cause the internal patient storage to needlessly 1810 grow (unboundedly, if the nurse is long-lived). 1811 `#1251 <https://github.com/pybind/pybind11/issues/1251>`_. 1812 1813 * Various other minor fixes. 1814 1815 v2.2.1 (September 14, 2017) 1816 ----------------------------------------------------- 1817 1818 * Added ``py::module_::reload()`` member function for reloading a module. 1819 `#1040 <https://github.com/pybind/pybind11/pull/1040>`_. 1820 1821 * Fixed a reference leak in the number converter. 1822 `#1078 <https://github.com/pybind/pybind11/pull/1078>`_. 1823 1824 * Fixed compilation with Clang on host GCC < 5 (old libstdc++ which isn't fully 1825 C++11 compliant). `#1062 <https://github.com/pybind/pybind11/pull/1062>`_. 1826 1827 * Fixed a regression where the automatic ``std::vector<bool>`` caster would 1828 fail to compile. The same fix also applies to any container which returns 1829 element proxies instead of references. 1830 `#1053 <https://github.com/pybind/pybind11/pull/1053>`_. 1831 1832 * Fixed a regression where the ``py::keep_alive`` policy could not be applied 1833 to constructors. `#1065 <https://github.com/pybind/pybind11/pull/1065>`_. 1834 1835 * Fixed a nullptr dereference when loading a ``py::module_local`` type 1836 that's only registered in an external module. 1837 `#1058 <https://github.com/pybind/pybind11/pull/1058>`_. 1838 1839 * Fixed implicit conversion of accessors to types derived from ``py::object``. 1840 `#1076 <https://github.com/pybind/pybind11/pull/1076>`_. 1841 1842 * The ``name`` in ``PYBIND11_MODULE(name, variable)`` can now be a macro. 1843 `#1082 <https://github.com/pybind/pybind11/pull/1082>`_. 1844 1845 * Relaxed overly strict ``py::pickle()`` check for matching get and set types. 1846 `#1064 <https://github.com/pybind/pybind11/pull/1064>`_. 1847 1848 * Conversion errors now try to be more informative when it's likely that 1849 a missing header is the cause (e.g. forgetting ``<pybind11/stl.h>``). 1850 `#1077 <https://github.com/pybind/pybind11/pull/1077>`_. 1851 1852 v2.2.0 (August 31, 2017) 1853 ----------------------------------------------------- 1854 1855 * Support for embedding the Python interpreter. See the 1856 :doc:`documentation page </advanced/embedding>` for a 1857 full overview of the new features. 1858 `#774 <https://github.com/pybind/pybind11/pull/774>`_, 1859 `#889 <https://github.com/pybind/pybind11/pull/889>`_, 1860 `#892 <https://github.com/pybind/pybind11/pull/892>`_, 1861 `#920 <https://github.com/pybind/pybind11/pull/920>`_. 1862 1863 .. code-block:: cpp 1864 1865 #include <pybind11/embed.h> 1866 namespace py = pybind11; 1867 1868 int main() { 1869 py::scoped_interpreter guard{}; // start the interpreter and keep it alive 1870 1871 py::print("Hello, World!"); // use the Python API 1872 } 1873 1874 * Support for inheriting from multiple C++ bases in Python. 1875 `#693 <https://github.com/pybind/pybind11/pull/693>`_. 1876 1877 .. code-block:: python 1878 1879 from cpp_module import CppBase1, CppBase2 1880 1881 1882 class PyDerived(CppBase1, CppBase2): 1883 def __init__(self): 1884 CppBase1.__init__(self) # C++ bases must be initialized explicitly 1885 CppBase2.__init__(self) 1886 1887 * ``PYBIND11_MODULE`` is now the preferred way to create module entry points. 1888 ``PYBIND11_PLUGIN`` is deprecated. See :ref:`macros` for details. 1889 `#879 <https://github.com/pybind/pybind11/pull/879>`_. 1890 1891 .. code-block:: cpp 1892 1893 // new 1894 PYBIND11_MODULE(example, m) { 1895 m.def("add", [](int a, int b) { return a + b; }); 1896 } 1897 1898 // old 1899 PYBIND11_PLUGIN(example) { 1900 py::module m("example"); 1901 m.def("add", [](int a, int b) { return a + b; }); 1902 return m.ptr(); 1903 } 1904 1905 * pybind11's headers and build system now more strictly enforce hidden symbol 1906 visibility for extension modules. This should be seamless for most users, 1907 but see the :doc:`upgrade` if you use a custom build system. 1908 `#995 <https://github.com/pybind/pybind11/pull/995>`_. 1909 1910 * Support for ``py::module_local`` types which allow multiple modules to 1911 export the same C++ types without conflicts. This is useful for opaque 1912 types like ``std::vector<int>``. ``py::bind_vector`` and ``py::bind_map`` 1913 now default to ``py::module_local`` if their elements are builtins or 1914 local types. See :ref:`module_local` for details. 1915 `#949 <https://github.com/pybind/pybind11/pull/949>`_, 1916 `#981 <https://github.com/pybind/pybind11/pull/981>`_, 1917 `#995 <https://github.com/pybind/pybind11/pull/995>`_, 1918 `#997 <https://github.com/pybind/pybind11/pull/997>`_. 1919 1920 * Custom constructors can now be added very easily using lambdas or factory 1921 functions which return a class instance by value, pointer or holder. This 1922 supersedes the old placement-new ``__init__`` technique. 1923 See :ref:`custom_constructors` for details. 1924 `#805 <https://github.com/pybind/pybind11/pull/805>`_, 1925 `#1014 <https://github.com/pybind/pybind11/pull/1014>`_. 1926 1927 .. code-block:: cpp 1928 1929 struct Example { 1930 Example(std::string); 1931 }; 1932 1933 py::class_<Example>(m, "Example") 1934 .def(py::init<std::string>()) // existing constructor 1935 .def(py::init([](int n) { // custom constructor 1936 return std::make_unique<Example>(std::to_string(n)); 1937 })); 1938 1939 * Similarly to custom constructors, pickling support functions are now bound 1940 using the ``py::pickle()`` adaptor which improves type safety. See the 1941 :doc:`upgrade` and :ref:`pickling` for details. 1942 `#1038 <https://github.com/pybind/pybind11/pull/1038>`_. 1943 1944 * Builtin support for converting C++17 standard library types and general 1945 conversion improvements: 1946 1947 1. C++17 ``std::variant`` is supported right out of the box. C++11/14 1948 equivalents (e.g. ``boost::variant``) can also be added with a simple 1949 user-defined specialization. See :ref:`cpp17_container_casters` for details. 1950 `#811 <https://github.com/pybind/pybind11/pull/811>`_, 1951 `#845 <https://github.com/pybind/pybind11/pull/845>`_, 1952 `#989 <https://github.com/pybind/pybind11/pull/989>`_. 1953 1954 2. Out-of-the-box support for C++17 ``std::string_view``. 1955 `#906 <https://github.com/pybind/pybind11/pull/906>`_. 1956 1957 3. Improved compatibility of the builtin ``optional`` converter. 1958 `#874 <https://github.com/pybind/pybind11/pull/874>`_. 1959 1960 4. The ``bool`` converter now accepts ``numpy.bool_`` and types which 1961 define ``__bool__`` (Python 3.x) or ``__nonzero__`` (Python 2.7). 1962 `#925 <https://github.com/pybind/pybind11/pull/925>`_. 1963 1964 5. C++-to-Python casters are now more efficient and move elements out 1965 of rvalue containers whenever possible. 1966 `#851 <https://github.com/pybind/pybind11/pull/851>`_, 1967 `#936 <https://github.com/pybind/pybind11/pull/936>`_, 1968 `#938 <https://github.com/pybind/pybind11/pull/938>`_. 1969 1970 6. Fixed ``bytes`` to ``std::string/char*`` conversion on Python 3. 1971 `#817 <https://github.com/pybind/pybind11/pull/817>`_. 1972 1973 7. Fixed lifetime of temporary C++ objects created in Python-to-C++ conversions. 1974 `#924 <https://github.com/pybind/pybind11/pull/924>`_. 1975 1976 * Scope guard call policy for RAII types, e.g. ``py::call_guard<py::gil_scoped_release>()``, 1977 ``py::call_guard<py::scoped_ostream_redirect>()``. See :ref:`call_policies` for details. 1978 `#740 <https://github.com/pybind/pybind11/pull/740>`_. 1979 1980 * Utility for redirecting C++ streams to Python (e.g. ``std::cout`` -> 1981 ``sys.stdout``). Scope guard ``py::scoped_ostream_redirect`` in C++ and 1982 a context manager in Python. See :ref:`ostream_redirect`. 1983 `#1009 <https://github.com/pybind/pybind11/pull/1009>`_. 1984 1985 * Improved handling of types and exceptions across module boundaries. 1986 `#915 <https://github.com/pybind/pybind11/pull/915>`_, 1987 `#951 <https://github.com/pybind/pybind11/pull/951>`_, 1988 `#995 <https://github.com/pybind/pybind11/pull/995>`_. 1989 1990 * Fixed destruction order of ``py::keep_alive`` nurse/patient objects 1991 in reference cycles. 1992 `#856 <https://github.com/pybind/pybind11/pull/856>`_. 1993 1994 * NumPy and buffer protocol related improvements: 1995 1996 1. Support for negative strides in Python buffer objects/numpy arrays. This 1997 required changing integers from unsigned to signed for the related C++ APIs. 1998 Note: If you have compiler warnings enabled, you may notice some new conversion 1999 warnings after upgrading. These can be resolved with ``static_cast``. 2000 `#782 <https://github.com/pybind/pybind11/pull/782>`_. 2001 2002 2. Support ``std::complex`` and arrays inside ``PYBIND11_NUMPY_DTYPE``. 2003 `#831 <https://github.com/pybind/pybind11/pull/831>`_, 2004 `#832 <https://github.com/pybind/pybind11/pull/832>`_. 2005 2006 3. Support for constructing ``py::buffer_info`` and ``py::arrays`` using 2007 arbitrary containers or iterators instead of requiring a ``std::vector``. 2008 `#788 <https://github.com/pybind/pybind11/pull/788>`_, 2009 `#822 <https://github.com/pybind/pybind11/pull/822>`_, 2010 `#860 <https://github.com/pybind/pybind11/pull/860>`_. 2011 2012 4. Explicitly check numpy version and require >= 1.7.0. 2013 `#819 <https://github.com/pybind/pybind11/pull/819>`_. 2014 2015 * Support for allowing/prohibiting ``None`` for specific arguments and improved 2016 ``None`` overload resolution order. See :ref:`none_arguments` for details. 2017 `#843 <https://github.com/pybind/pybind11/pull/843>`_. 2018 `#859 <https://github.com/pybind/pybind11/pull/859>`_. 2019 2020 * Added ``py::exec()`` as a shortcut for ``py::eval<py::eval_statements>()`` 2021 and support for C++11 raw string literals as input. See :ref:`eval`. 2022 `#766 <https://github.com/pybind/pybind11/pull/766>`_, 2023 `#827 <https://github.com/pybind/pybind11/pull/827>`_. 2024 2025 * ``py::vectorize()`` ignores non-vectorizable arguments and supports 2026 member functions. 2027 `#762 <https://github.com/pybind/pybind11/pull/762>`_. 2028 2029 * Support for bound methods as callbacks (``pybind11/functional.h``). 2030 `#815 <https://github.com/pybind/pybind11/pull/815>`_. 2031 2032 * Allow aliasing pybind11 methods: ``cls.attr("foo") = cls.attr("bar")``. 2033 `#802 <https://github.com/pybind/pybind11/pull/802>`_. 2034 2035 * Don't allow mixed static/non-static overloads. 2036 `#804 <https://github.com/pybind/pybind11/pull/804>`_. 2037 2038 * Fixed overriding static properties in derived classes. 2039 `#784 <https://github.com/pybind/pybind11/pull/784>`_. 2040 2041 * Added support for write only properties. 2042 `#1144 <https://github.com/pybind/pybind11/pull/1144>`_. 2043 2044 * Improved deduction of member functions of a derived class when its bases 2045 aren't registered with pybind11. 2046 `#855 <https://github.com/pybind/pybind11/pull/855>`_. 2047 2048 .. code-block:: cpp 2049 2050 struct Base { 2051 int foo() { return 42; } 2052 } 2053 2054 struct Derived : Base {} 2055 2056 // Now works, but previously required also binding `Base` 2057 py::class_<Derived>(m, "Derived") 2058 .def("foo", &Derived::foo); // function is actually from `Base` 2059 2060 * The implementation of ``py::init<>`` now uses C++11 brace initialization 2061 syntax to construct instances, which permits binding implicit constructors of 2062 aggregate types. `#1015 <https://github.com/pybind/pybind11/pull/1015>`_. 2063 2064 .. code-block:: cpp 2065 2066 struct Aggregate { 2067 int a; 2068 std::string b; 2069 }; 2070 2071 py::class_<Aggregate>(m, "Aggregate") 2072 .def(py::init<int, const std::string &>()); 2073 2074 * Fixed issues with multiple inheritance with offset base/derived pointers. 2075 `#812 <https://github.com/pybind/pybind11/pull/812>`_, 2076 `#866 <https://github.com/pybind/pybind11/pull/866>`_, 2077 `#960 <https://github.com/pybind/pybind11/pull/960>`_. 2078 2079 * Fixed reference leak of type objects. 2080 `#1030 <https://github.com/pybind/pybind11/pull/1030>`_. 2081 2082 * Improved support for the ``/std:c++14`` and ``/std:c++latest`` modes 2083 on MSVC 2017. 2084 `#841 <https://github.com/pybind/pybind11/pull/841>`_, 2085 `#999 <https://github.com/pybind/pybind11/pull/999>`_. 2086 2087 * Fixed detection of private operator new on MSVC. 2088 `#893 <https://github.com/pybind/pybind11/pull/893>`_, 2089 `#918 <https://github.com/pybind/pybind11/pull/918>`_. 2090 2091 * Intel C++ compiler compatibility fixes. 2092 `#937 <https://github.com/pybind/pybind11/pull/937>`_. 2093 2094 * Fixed implicit conversion of ``py::enum_`` to integer types on Python 2.7. 2095 `#821 <https://github.com/pybind/pybind11/pull/821>`_. 2096 2097 * Added ``py::hash`` to fetch the hash value of Python objects, and 2098 ``.def(hash(py::self))`` to provide the C++ ``std::hash`` as the Python 2099 ``__hash__`` method. 2100 `#1034 <https://github.com/pybind/pybind11/pull/1034>`_. 2101 2102 * Fixed ``__truediv__`` on Python 2 and ``__itruediv__`` on Python 3. 2103 `#867 <https://github.com/pybind/pybind11/pull/867>`_. 2104 2105 * ``py::capsule`` objects now support the ``name`` attribute. This is useful 2106 for interfacing with ``scipy.LowLevelCallable``. 2107 `#902 <https://github.com/pybind/pybind11/pull/902>`_. 2108 2109 * Fixed ``py::make_iterator``'s ``__next__()`` for past-the-end calls. 2110 `#897 <https://github.com/pybind/pybind11/pull/897>`_. 2111 2112 * Added ``error_already_set::matches()`` for checking Python exceptions. 2113 `#772 <https://github.com/pybind/pybind11/pull/772>`_. 2114 2115 * Deprecated ``py::error_already_set::clear()``. It's no longer needed 2116 following a simplification of the ``py::error_already_set`` class. 2117 `#954 <https://github.com/pybind/pybind11/pull/954>`_. 2118 2119 * Deprecated ``py::handle::operator==()`` in favor of ``py::handle::is()`` 2120 `#825 <https://github.com/pybind/pybind11/pull/825>`_. 2121 2122 * Deprecated ``py::object::borrowed``/``py::object::stolen``. 2123 Use ``py::object::borrowed_t{}``/``py::object::stolen_t{}`` instead. 2124 `#771 <https://github.com/pybind/pybind11/pull/771>`_. 2125 2126 * Changed internal data structure versioning to avoid conflicts between 2127 modules compiled with different revisions of pybind11. 2128 `#1012 <https://github.com/pybind/pybind11/pull/1012>`_. 2129 2130 * Additional compile-time and run-time error checking and more informative messages. 2131 `#786 <https://github.com/pybind/pybind11/pull/786>`_, 2132 `#794 <https://github.com/pybind/pybind11/pull/794>`_, 2133 `#803 <https://github.com/pybind/pybind11/pull/803>`_. 2134 2135 * Various minor improvements and fixes. 2136 `#764 <https://github.com/pybind/pybind11/pull/764>`_, 2137 `#791 <https://github.com/pybind/pybind11/pull/791>`_, 2138 `#795 <https://github.com/pybind/pybind11/pull/795>`_, 2139 `#840 <https://github.com/pybind/pybind11/pull/840>`_, 2140 `#844 <https://github.com/pybind/pybind11/pull/844>`_, 2141 `#846 <https://github.com/pybind/pybind11/pull/846>`_, 2142 `#849 <https://github.com/pybind/pybind11/pull/849>`_, 2143 `#858 <https://github.com/pybind/pybind11/pull/858>`_, 2144 `#862 <https://github.com/pybind/pybind11/pull/862>`_, 2145 `#871 <https://github.com/pybind/pybind11/pull/871>`_, 2146 `#872 <https://github.com/pybind/pybind11/pull/872>`_, 2147 `#881 <https://github.com/pybind/pybind11/pull/881>`_, 2148 `#888 <https://github.com/pybind/pybind11/pull/888>`_, 2149 `#899 <https://github.com/pybind/pybind11/pull/899>`_, 2150 `#928 <https://github.com/pybind/pybind11/pull/928>`_, 2151 `#931 <https://github.com/pybind/pybind11/pull/931>`_, 2152 `#944 <https://github.com/pybind/pybind11/pull/944>`_, 2153 `#950 <https://github.com/pybind/pybind11/pull/950>`_, 2154 `#952 <https://github.com/pybind/pybind11/pull/952>`_, 2155 `#962 <https://github.com/pybind/pybind11/pull/962>`_, 2156 `#965 <https://github.com/pybind/pybind11/pull/965>`_, 2157 `#970 <https://github.com/pybind/pybind11/pull/970>`_, 2158 `#978 <https://github.com/pybind/pybind11/pull/978>`_, 2159 `#979 <https://github.com/pybind/pybind11/pull/979>`_, 2160 `#986 <https://github.com/pybind/pybind11/pull/986>`_, 2161 `#1020 <https://github.com/pybind/pybind11/pull/1020>`_, 2162 `#1027 <https://github.com/pybind/pybind11/pull/1027>`_, 2163 `#1037 <https://github.com/pybind/pybind11/pull/1037>`_. 2164 2165 * Testing improvements. 2166 `#798 <https://github.com/pybind/pybind11/pull/798>`_, 2167 `#882 <https://github.com/pybind/pybind11/pull/882>`_, 2168 `#898 <https://github.com/pybind/pybind11/pull/898>`_, 2169 `#900 <https://github.com/pybind/pybind11/pull/900>`_, 2170 `#921 <https://github.com/pybind/pybind11/pull/921>`_, 2171 `#923 <https://github.com/pybind/pybind11/pull/923>`_, 2172 `#963 <https://github.com/pybind/pybind11/pull/963>`_. 2173 2174 v2.1.1 (April 7, 2017) 2175 ----------------------------------------------------- 2176 2177 * Fixed minimum version requirement for MSVC 2015u3 2178 `#773 <https://github.com/pybind/pybind11/pull/773>`_. 2179 2180 v2.1.0 (March 22, 2017) 2181 ----------------------------------------------------- 2182 2183 * pybind11 now performs function overload resolution in two phases. The first 2184 phase only considers exact type matches, while the second allows for implicit 2185 conversions to take place. A special ``noconvert()`` syntax can be used to 2186 completely disable implicit conversions for specific arguments. 2187 `#643 <https://github.com/pybind/pybind11/pull/643>`_, 2188 `#634 <https://github.com/pybind/pybind11/pull/634>`_, 2189 `#650 <https://github.com/pybind/pybind11/pull/650>`_. 2190 2191 * Fixed a regression where static properties no longer worked with classes 2192 using multiple inheritance. The ``py::metaclass`` attribute is no longer 2193 necessary (and deprecated as of this release) when binding classes with 2194 static properties. 2195 `#679 <https://github.com/pybind/pybind11/pull/679>`_, 2196 2197 * Classes bound using ``pybind11`` can now use custom metaclasses. 2198 `#679 <https://github.com/pybind/pybind11/pull/679>`_, 2199 2200 * ``py::args`` and ``py::kwargs`` can now be mixed with other positional 2201 arguments when binding functions using pybind11. 2202 `#611 <https://github.com/pybind/pybind11/pull/611>`_. 2203 2204 * Improved support for C++11 unicode string and character types; added 2205 extensive documentation regarding pybind11's string conversion behavior. 2206 `#624 <https://github.com/pybind/pybind11/pull/624>`_, 2207 `#636 <https://github.com/pybind/pybind11/pull/636>`_, 2208 `#715 <https://github.com/pybind/pybind11/pull/715>`_. 2209 2210 * pybind11 can now avoid expensive copies when converting Eigen arrays to NumPy 2211 arrays (and vice versa). `#610 <https://github.com/pybind/pybind11/pull/610>`_. 2212 2213 * The "fast path" in ``py::vectorize`` now works for any full-size group of C or 2214 F-contiguous arrays. The non-fast path is also faster since it no longer performs 2215 copies of the input arguments (except when type conversions are necessary). 2216 `#610 <https://github.com/pybind/pybind11/pull/610>`_. 2217 2218 * Added fast, unchecked access to NumPy arrays via a proxy object. 2219 `#746 <https://github.com/pybind/pybind11/pull/746>`_. 2220 2221 * Transparent support for class-specific ``operator new`` and 2222 ``operator delete`` implementations. 2223 `#755 <https://github.com/pybind/pybind11/pull/755>`_. 2224 2225 * Slimmer and more efficient STL-compatible iterator interface for sequence types. 2226 `#662 <https://github.com/pybind/pybind11/pull/662>`_. 2227 2228 * Improved custom holder type support. 2229 `#607 <https://github.com/pybind/pybind11/pull/607>`_. 2230 2231 * ``nullptr`` to ``None`` conversion fixed in various builtin type casters. 2232 `#732 <https://github.com/pybind/pybind11/pull/732>`_. 2233 2234 * ``enum_`` now exposes its members via a special ``__members__`` attribute. 2235 `#666 <https://github.com/pybind/pybind11/pull/666>`_. 2236 2237 * ``std::vector`` bindings created using ``stl_bind.h`` can now optionally 2238 implement the buffer protocol. `#488 <https://github.com/pybind/pybind11/pull/488>`_. 2239 2240 * Automated C++ reference documentation using doxygen and breathe. 2241 `#598 <https://github.com/pybind/pybind11/pull/598>`_. 2242 2243 * Added minimum compiler version assertions. 2244 `#727 <https://github.com/pybind/pybind11/pull/727>`_. 2245 2246 * Improved compatibility with C++1z. 2247 `#677 <https://github.com/pybind/pybind11/pull/677>`_. 2248 2249 * Improved ``py::capsule`` API. Can be used to implement cleanup 2250 callbacks that are involved at module destruction time. 2251 `#752 <https://github.com/pybind/pybind11/pull/752>`_. 2252 2253 * Various minor improvements and fixes. 2254 `#595 <https://github.com/pybind/pybind11/pull/595>`_, 2255 `#588 <https://github.com/pybind/pybind11/pull/588>`_, 2256 `#589 <https://github.com/pybind/pybind11/pull/589>`_, 2257 `#603 <https://github.com/pybind/pybind11/pull/603>`_, 2258 `#619 <https://github.com/pybind/pybind11/pull/619>`_, 2259 `#648 <https://github.com/pybind/pybind11/pull/648>`_, 2260 `#695 <https://github.com/pybind/pybind11/pull/695>`_, 2261 `#720 <https://github.com/pybind/pybind11/pull/720>`_, 2262 `#723 <https://github.com/pybind/pybind11/pull/723>`_, 2263 `#729 <https://github.com/pybind/pybind11/pull/729>`_, 2264 `#724 <https://github.com/pybind/pybind11/pull/724>`_, 2265 `#742 <https://github.com/pybind/pybind11/pull/742>`_, 2266 `#753 <https://github.com/pybind/pybind11/pull/753>`_. 2267 2268 v2.0.1 (Jan 4, 2017) 2269 ----------------------------------------------------- 2270 2271 * Fix pointer to reference error in type_caster on MSVC 2272 `#583 <https://github.com/pybind/pybind11/pull/583>`_. 2273 2274 * Fixed a segmentation in the test suite due to a typo 2275 `cd7eac <https://github.com/pybind/pybind11/commit/cd7eac>`_. 2276 2277 v2.0.0 (Jan 1, 2017) 2278 ----------------------------------------------------- 2279 2280 * Fixed a reference counting regression affecting types with custom metaclasses 2281 (introduced in v2.0.0-rc1). 2282 `#571 <https://github.com/pybind/pybind11/pull/571>`_. 2283 2284 * Quenched a CMake policy warning. 2285 `#570 <https://github.com/pybind/pybind11/pull/570>`_. 2286 2287 v2.0.0-rc1 (Dec 23, 2016) 2288 ----------------------------------------------------- 2289 2290 The pybind11 developers are excited to issue a release candidate of pybind11 2291 with a subsequent v2.0.0 release planned in early January next year. 2292 2293 An incredible amount of effort by went into pybind11 over the last ~5 months, 2294 leading to a release that is jam-packed with exciting new features and numerous 2295 usability improvements. The following list links PRs or individual commits 2296 whenever applicable. 2297 2298 Happy Christmas! 2299 2300 * Support for binding C++ class hierarchies that make use of multiple 2301 inheritance. `#410 <https://github.com/pybind/pybind11/pull/410>`_. 2302 2303 * PyPy support: pybind11 now supports nightly builds of PyPy and will 2304 interoperate with the future 5.7 release. No code changes are necessary, 2305 everything "just" works as usual. Note that we only target the Python 2.7 2306 branch for now; support for 3.x will be added once its ``cpyext`` extension 2307 support catches up. A few minor features remain unsupported for the time 2308 being (notably dynamic attributes in custom types). 2309 `#527 <https://github.com/pybind/pybind11/pull/527>`_. 2310 2311 * Significant work on the documentation -- in particular, the monolithic 2312 ``advanced.rst`` file was restructured into a easier to read hierarchical 2313 organization. `#448 <https://github.com/pybind/pybind11/pull/448>`_. 2314 2315 * Many NumPy-related improvements: 2316 2317 1. Object-oriented API to access and modify NumPy ``ndarray`` instances, 2318 replicating much of the corresponding NumPy C API functionality. 2319 `#402 <https://github.com/pybind/pybind11/pull/402>`_. 2320 2321 2. NumPy array ``dtype`` array descriptors are now first-class citizens and 2322 are exposed via a new class ``py::dtype``. 2323 2324 3. Structured dtypes can be registered using the ``PYBIND11_NUMPY_DTYPE()`` 2325 macro. Special ``array`` constructors accepting dtype objects were also 2326 added. 2327 2328 One potential caveat involving this change: format descriptor strings 2329 should now be accessed via ``format_descriptor::format()`` (however, for 2330 compatibility purposes, the old syntax ``format_descriptor::value`` will 2331 still work for non-structured data types). `#308 2332 <https://github.com/pybind/pybind11/pull/308>`_. 2333 2334 4. Further improvements to support structured dtypes throughout the system. 2335 `#472 <https://github.com/pybind/pybind11/pull/472>`_, 2336 `#474 <https://github.com/pybind/pybind11/pull/474>`_, 2337 `#459 <https://github.com/pybind/pybind11/pull/459>`_, 2338 `#453 <https://github.com/pybind/pybind11/pull/453>`_, 2339 `#452 <https://github.com/pybind/pybind11/pull/452>`_, and 2340 `#505 <https://github.com/pybind/pybind11/pull/505>`_. 2341 2342 5. Fast access operators. `#497 <https://github.com/pybind/pybind11/pull/497>`_. 2343 2344 6. Constructors for arrays whose storage is owned by another object. 2345 `#440 <https://github.com/pybind/pybind11/pull/440>`_. 2346 2347 7. Added constructors for ``array`` and ``array_t`` explicitly accepting shape 2348 and strides; if strides are not provided, they are deduced assuming 2349 C-contiguity. Also added simplified constructors for 1-dimensional case. 2350 2351 8. Added buffer/NumPy support for ``char[N]`` and ``std::array<char, N>`` types. 2352 2353 9. Added ``memoryview`` wrapper type which is constructible from ``buffer_info``. 2354 2355 * Eigen: many additional conversions and support for non-contiguous 2356 arrays/slices. 2357 `#427 <https://github.com/pybind/pybind11/pull/427>`_, 2358 `#315 <https://github.com/pybind/pybind11/pull/315>`_, 2359 `#316 <https://github.com/pybind/pybind11/pull/316>`_, 2360 `#312 <https://github.com/pybind/pybind11/pull/312>`_, and 2361 `#267 <https://github.com/pybind/pybind11/pull/267>`_ 2362 2363 * Incompatible changes in ``class_<...>::class_()``: 2364 2365 1. Declarations of types that provide access via the buffer protocol must 2366 now include the ``py::buffer_protocol()`` annotation as an argument to 2367 the ``class_`` constructor. 2368 2369 2. Declarations of types that require a custom metaclass (i.e. all classes 2370 which include static properties via commands such as 2371 ``def_readwrite_static()``) must now include the ``py::metaclass()`` 2372 annotation as an argument to the ``class_`` constructor. 2373 2374 These two changes were necessary to make type definitions in pybind11 2375 future-proof, and to support PyPy via its cpyext mechanism. `#527 2376 <https://github.com/pybind/pybind11/pull/527>`_. 2377 2378 2379 3. This version of pybind11 uses a redesigned mechanism for instantiating 2380 trampoline classes that are used to override virtual methods from within 2381 Python. This led to the following user-visible syntax change: instead of 2382 2383 .. code-block:: cpp 2384 2385 py::class_<TrampolineClass>("MyClass") 2386 .alias<MyClass>() 2387 .... 2388 2389 write 2390 2391 .. code-block:: cpp 2392 2393 py::class_<MyClass, TrampolineClass>("MyClass") 2394 .... 2395 2396 Importantly, both the original and the trampoline class are now 2397 specified as an arguments (in arbitrary order) to the ``py::class_`` 2398 template, and the ``alias<..>()`` call is gone. The new scheme has zero 2399 overhead in cases when Python doesn't override any functions of the 2400 underlying C++ class. `rev. 86d825 2401 <https://github.com/pybind/pybind11/commit/86d825>`_. 2402 2403 * Added ``eval`` and ``eval_file`` functions for evaluating expressions and 2404 statements from a string or file. `rev. 0d3fc3 2405 <https://github.com/pybind/pybind11/commit/0d3fc3>`_. 2406 2407 * pybind11 can now create types with a modifiable dictionary. 2408 `#437 <https://github.com/pybind/pybind11/pull/437>`_ and 2409 `#444 <https://github.com/pybind/pybind11/pull/444>`_. 2410 2411 * Support for translation of arbitrary C++ exceptions to Python counterparts. 2412 `#296 <https://github.com/pybind/pybind11/pull/296>`_ and 2413 `#273 <https://github.com/pybind/pybind11/pull/273>`_. 2414 2415 * Report full backtraces through mixed C++/Python code, better reporting for 2416 import errors, fixed GIL management in exception processing. 2417 `#537 <https://github.com/pybind/pybind11/pull/537>`_, 2418 `#494 <https://github.com/pybind/pybind11/pull/494>`_, 2419 `rev. e72d95 <https://github.com/pybind/pybind11/commit/e72d95>`_, and 2420 `rev. 099d6e <https://github.com/pybind/pybind11/commit/099d6e>`_. 2421 2422 * Support for bit-level operations, comparisons, and serialization of C++ 2423 enumerations. `#503 <https://github.com/pybind/pybind11/pull/503>`_, 2424 `#508 <https://github.com/pybind/pybind11/pull/508>`_, 2425 `#380 <https://github.com/pybind/pybind11/pull/380>`_, 2426 `#309 <https://github.com/pybind/pybind11/pull/309>`_. 2427 `#311 <https://github.com/pybind/pybind11/pull/311>`_. 2428 2429 * The ``class_`` constructor now accepts its template arguments in any order. 2430 `#385 <https://github.com/pybind/pybind11/pull/385>`_. 2431 2432 * Attribute and item accessors now have a more complete interface which makes 2433 it possible to chain attributes as in 2434 ``obj.attr("a")[key].attr("b").attr("method")(1, 2, 3)``. `#425 2435 <https://github.com/pybind/pybind11/pull/425>`_. 2436 2437 * Major redesign of the default and conversion constructors in ``pytypes.h``. 2438 `#464 <https://github.com/pybind/pybind11/pull/464>`_. 2439 2440 * Added built-in support for ``std::shared_ptr`` holder type. It is no longer 2441 necessary to to include a declaration of the form 2442 ``PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>)`` (though continuing to 2443 do so won't cause an error). 2444 `#454 <https://github.com/pybind/pybind11/pull/454>`_. 2445 2446 * New ``py::overload_cast`` casting operator to select among multiple possible 2447 overloads of a function. An example: 2448 2449 .. code-block:: cpp 2450 2451 py::class_<Pet>(m, "Pet") 2452 .def("set", py::overload_cast<int>(&Pet::set), "Set the pet's age") 2453 .def("set", py::overload_cast<const std::string &>(&Pet::set), "Set the pet's name"); 2454 2455 This feature only works on C++14-capable compilers. 2456 `#541 <https://github.com/pybind/pybind11/pull/541>`_. 2457 2458 * C++ types are automatically cast to Python types, e.g. when assigning 2459 them as an attribute. For instance, the following is now legal: 2460 2461 .. code-block:: cpp 2462 2463 py::module m = /* ... */ 2464 m.attr("constant") = 123; 2465 2466 (Previously, a ``py::cast`` call was necessary to avoid a compilation error.) 2467 `#551 <https://github.com/pybind/pybind11/pull/551>`_. 2468 2469 * Redesigned ``pytest``-based test suite. `#321 <https://github.com/pybind/pybind11/pull/321>`_. 2470 2471 * Instance tracking to detect reference leaks in test suite. `#324 <https://github.com/pybind/pybind11/pull/324>`_ 2472 2473 * pybind11 can now distinguish between multiple different instances that are 2474 located at the same memory address, but which have different types. 2475 `#329 <https://github.com/pybind/pybind11/pull/329>`_. 2476 2477 * Improved logic in ``move`` return value policy. 2478 `#510 <https://github.com/pybind/pybind11/pull/510>`_, 2479 `#297 <https://github.com/pybind/pybind11/pull/297>`_. 2480 2481 * Generalized unpacking API to permit calling Python functions from C++ using 2482 notation such as ``foo(a1, a2, *args, "ka"_a=1, "kb"_a=2, **kwargs)``. `#372 <https://github.com/pybind/pybind11/pull/372>`_. 2483 2484 * ``py::print()`` function whose behavior matches that of the native Python 2485 ``print()`` function. `#372 <https://github.com/pybind/pybind11/pull/372>`_. 2486 2487 * Added ``py::dict`` keyword constructor:``auto d = dict("number"_a=42, 2488 "name"_a="World");``. `#372 <https://github.com/pybind/pybind11/pull/372>`_. 2489 2490 * Added ``py::str::format()`` method and ``_s`` literal: ``py::str s = "1 + 2 2491 = {}"_s.format(3);``. `#372 <https://github.com/pybind/pybind11/pull/372>`_. 2492 2493 * Added ``py::repr()`` function which is equivalent to Python's builtin 2494 ``repr()``. `#333 <https://github.com/pybind/pybind11/pull/333>`_. 2495 2496 * Improved construction and destruction logic for holder types. It is now 2497 possible to reference instances with smart pointer holder types without 2498 constructing the holder if desired. The ``PYBIND11_DECLARE_HOLDER_TYPE`` 2499 macro now accepts an optional second parameter to indicate whether the holder 2500 type uses intrusive reference counting. 2501 `#533 <https://github.com/pybind/pybind11/pull/533>`_ and 2502 `#561 <https://github.com/pybind/pybind11/pull/561>`_. 2503 2504 * Mapping a stateless C++ function to Python and back is now "for free" (i.e. 2505 no extra indirections or argument conversion overheads). `rev. 954b79 2506 <https://github.com/pybind/pybind11/commit/954b79>`_. 2507 2508 * Bindings for ``std::valarray<T>``. 2509 `#545 <https://github.com/pybind/pybind11/pull/545>`_. 2510 2511 * Improved support for C++17 capable compilers. 2512 `#562 <https://github.com/pybind/pybind11/pull/562>`_. 2513 2514 * Bindings for ``std::optional<t>``. 2515 `#475 <https://github.com/pybind/pybind11/pull/475>`_, 2516 `#476 <https://github.com/pybind/pybind11/pull/476>`_, 2517 `#479 <https://github.com/pybind/pybind11/pull/479>`_, 2518 `#499 <https://github.com/pybind/pybind11/pull/499>`_, and 2519 `#501 <https://github.com/pybind/pybind11/pull/501>`_. 2520 2521 * ``stl_bind.h``: general improvements and support for ``std::map`` and 2522 ``std::unordered_map``. 2523 `#490 <https://github.com/pybind/pybind11/pull/490>`_, 2524 `#282 <https://github.com/pybind/pybind11/pull/282>`_, 2525 `#235 <https://github.com/pybind/pybind11/pull/235>`_. 2526 2527 * The ``std::tuple``, ``std::pair``, ``std::list``, and ``std::vector`` type 2528 casters now accept any Python sequence type as input. `rev. 107285 2529 <https://github.com/pybind/pybind11/commit/107285>`_. 2530 2531 * Improved CMake Python detection on multi-architecture Linux. 2532 `#532 <https://github.com/pybind/pybind11/pull/532>`_. 2533 2534 * Infrastructure to selectively disable or enable parts of the automatically 2535 generated docstrings. `#486 <https://github.com/pybind/pybind11/pull/486>`_. 2536 2537 * ``reference`` and ``reference_internal`` are now the default return value 2538 properties for static and non-static properties, respectively. `#473 2539 <https://github.com/pybind/pybind11/pull/473>`_. (the previous defaults 2540 were ``automatic``). `#473 <https://github.com/pybind/pybind11/pull/473>`_. 2541 2542 * Support for ``std::unique_ptr`` with non-default deleters or no deleter at 2543 all (``py::nodelete``). `#384 <https://github.com/pybind/pybind11/pull/384>`_. 2544 2545 * Deprecated ``handle::call()`` method. The new syntax to call Python 2546 functions is simply ``handle()``. It can also be invoked explicitly via 2547 ``handle::operator<X>()``, where ``X`` is an optional return value policy. 2548 2549 * Print more informative error messages when ``make_tuple()`` or ``cast()`` 2550 fail. `#262 <https://github.com/pybind/pybind11/pull/262>`_. 2551 2552 * Creation of holder types for classes deriving from 2553 ``std::enable_shared_from_this<>`` now also works for ``const`` values. 2554 `#260 <https://github.com/pybind/pybind11/pull/260>`_. 2555 2556 * ``make_iterator()`` improvements for better compatibility with various 2557 types (now uses prefix increment operator); it now also accepts iterators 2558 with different begin/end types as long as they are equality comparable. 2559 `#247 <https://github.com/pybind/pybind11/pull/247>`_. 2560 2561 * ``arg()`` now accepts a wider range of argument types for default values. 2562 `#244 <https://github.com/pybind/pybind11/pull/244>`_. 2563 2564 * Support ``keep_alive`` where the nurse object may be ``None``. `#341 2565 <https://github.com/pybind/pybind11/pull/341>`_. 2566 2567 * Added constructors for ``str`` and ``bytes`` from zero-terminated char 2568 pointers, and from char pointers and length. Added constructors for ``str`` 2569 from ``bytes`` and for ``bytes`` from ``str``, which will perform UTF-8 2570 decoding/encoding as required. 2571 2572 * Many other improvements of library internals without user-visible changes 2573 2574 2575 1.8.1 (July 12, 2016) 2576 ---------------------- 2577 * Fixed a rare but potentially very severe issue when the garbage collector ran 2578 during pybind11 type creation. 2579 2580 1.8.0 (June 14, 2016) 2581 ---------------------- 2582 * Redesigned CMake build system which exports a convenient 2583 ``pybind11_add_module`` function to parent projects. 2584 * ``std::vector<>`` type bindings analogous to Boost.Python's ``indexing_suite`` 2585 * Transparent conversion of sparse and dense Eigen matrices and vectors (``eigen.h``) 2586 * Added an ``ExtraFlags`` template argument to the NumPy ``array_t<>`` wrapper 2587 to disable an enforced cast that may lose precision, e.g. to create overloads 2588 for different precisions and complex vs real-valued matrices. 2589 * Prevent implicit conversion of floating point values to integral types in 2590 function arguments 2591 * Fixed incorrect default return value policy for functions returning a shared 2592 pointer 2593 * Don't allow registering a type via ``class_`` twice 2594 * Don't allow casting a ``None`` value into a C++ lvalue reference 2595 * Fixed a crash in ``enum_::operator==`` that was triggered by the ``help()`` command 2596 * Improved detection of whether or not custom C++ types can be copy/move-constructed 2597 * Extended ``str`` type to also work with ``bytes`` instances 2598 * Added a ``"name"_a`` user defined string literal that is equivalent to ``py::arg("name")``. 2599 * When specifying function arguments via ``py::arg``, the test that verifies 2600 the number of arguments now runs at compile time. 2601 * Added ``[[noreturn]]`` attribute to ``pybind11_fail()`` to quench some 2602 compiler warnings 2603 * List function arguments in exception text when the dispatch code cannot find 2604 a matching overload 2605 * Added ``PYBIND11_OVERLOAD_NAME`` and ``PYBIND11_OVERLOAD_PURE_NAME`` macros which 2606 can be used to override virtual methods whose name differs in C++ and Python 2607 (e.g. ``__call__`` and ``operator()``) 2608 * Various minor ``iterator`` and ``make_iterator()`` improvements 2609 * Transparently support ``__bool__`` on Python 2.x and Python 3.x 2610 * Fixed issue with destructor of unpickled object not being called 2611 * Minor CMake build system improvements on Windows 2612 * New ``pybind11::args`` and ``pybind11::kwargs`` types to create functions which 2613 take an arbitrary number of arguments and keyword arguments 2614 * New syntax to call a Python function from C++ using ``*args`` and ``*kwargs`` 2615 * The functions ``def_property_*`` now correctly process docstring arguments (these 2616 formerly caused a segmentation fault) 2617 * Many ``mkdoc.py`` improvements (enumerations, template arguments, ``DOC()`` 2618 macro accepts more arguments) 2619 * Cygwin support 2620 * Documentation improvements (pickling support, ``keep_alive``, macro usage) 2621 2622 1.7 (April 30, 2016) 2623 ---------------------- 2624 * Added a new ``move`` return value policy that triggers C++11 move semantics. 2625 The automatic return value policy falls back to this case whenever a rvalue 2626 reference is encountered 2627 * Significantly more general GIL state routines that are used instead of 2628 Python's troublesome ``PyGILState_Ensure`` and ``PyGILState_Release`` API 2629 * Redesign of opaque types that drastically simplifies their usage 2630 * Extended ability to pass values of type ``[const] void *`` 2631 * ``keep_alive`` fix: don't fail when there is no patient 2632 * ``functional.h``: acquire the GIL before calling a Python function 2633 * Added Python RAII type wrappers ``none`` and ``iterable`` 2634 * Added ``*args`` and ``*kwargs`` pass-through parameters to 2635 ``pybind11.get_include()`` function 2636 * Iterator improvements and fixes 2637 * Documentation on return value policies and opaque types improved 2638 2639 1.6 (April 30, 2016) 2640 ---------------------- 2641 * Skipped due to upload to PyPI gone wrong and inability to recover 2642 (https://github.com/pypa/packaging-problems/issues/74) 2643 2644 1.5 (April 21, 2016) 2645 ---------------------- 2646 * For polymorphic types, use RTTI to try to return the closest type registered with pybind11 2647 * Pickling support for serializing and unserializing C++ instances to a byte stream in Python 2648 * Added a convenience routine ``make_iterator()`` which turns a range indicated 2649 by a pair of C++ iterators into a iterable Python object 2650 * Added ``len()`` and a variadic ``make_tuple()`` function 2651 * Addressed a rare issue that could confuse the current virtual function 2652 dispatcher and another that could lead to crashes in multi-threaded 2653 applications 2654 * Added a ``get_include()`` function to the Python module that returns the path 2655 of the directory containing the installed pybind11 header files 2656 * Documentation improvements: import issues, symbol visibility, pickling, limitations 2657 * Added casting support for ``std::reference_wrapper<>`` 2658 2659 1.4 (April 7, 2016) 2660 -------------------------- 2661 * Transparent type conversion for ``std::wstring`` and ``wchar_t`` 2662 * Allow passing ``nullptr``-valued strings 2663 * Transparent passing of ``void *`` pointers using capsules 2664 * Transparent support for returning values wrapped in ``std::unique_ptr<>`` 2665 * Improved docstring generation for compatibility with Sphinx 2666 * Nicer debug error message when default parameter construction fails 2667 * Support for "opaque" types that bypass the transparent conversion layer for STL containers 2668 * Redesigned type casting interface to avoid ambiguities that could occasionally cause compiler errors 2669 * Redesigned property implementation; fixes crashes due to an unfortunate default return value policy 2670 * Anaconda package generation support 2671 2672 1.3 (March 8, 2016) 2673 -------------------------- 2674 2675 * Added support for the Intel C++ compiler (v15+) 2676 * Added support for the STL unordered set/map data structures 2677 * Added support for the STL linked list data structure 2678 * NumPy-style broadcasting support in ``pybind11::vectorize`` 2679 * pybind11 now displays more verbose error messages when ``arg::operator=()`` fails 2680 * pybind11 internal data structures now live in a version-dependent namespace to avoid ABI issues 2681 * Many, many bugfixes involving corner cases and advanced usage 2682 2683 1.2 (February 7, 2016) 2684 -------------------------- 2685 2686 * Optional: efficient generation of function signatures at compile time using C++14 2687 * Switched to a simpler and more general way of dealing with function default 2688 arguments. Unused keyword arguments in function calls are now detected and 2689 cause errors as expected 2690 * New ``keep_alive`` call policy analogous to Boost.Python's ``with_custodian_and_ward`` 2691 * New ``pybind11::base<>`` attribute to indicate a subclass relationship 2692 * Improved interface for RAII type wrappers in ``pytypes.h`` 2693 * Use RAII type wrappers consistently within pybind11 itself. This 2694 fixes various potential refcount leaks when exceptions occur 2695 * Added new ``bytes`` RAII type wrapper (maps to ``string`` in Python 2.7) 2696 * Made handle and related RAII classes const correct, using them more 2697 consistently everywhere now 2698 * Got rid of the ugly ``__pybind11__`` attributes on the Python side---they are 2699 now stored in a C++ hash table that is not visible in Python 2700 * Fixed refcount leaks involving NumPy arrays and bound functions 2701 * Vastly improved handling of shared/smart pointers 2702 * Removed an unnecessary copy operation in ``pybind11::vectorize`` 2703 * Fixed naming clashes when both pybind11 and NumPy headers are included 2704 * Added conversions for additional exception types 2705 * Documentation improvements (using multiple extension modules, smart pointers, 2706 other minor clarifications) 2707 * unified infrastructure for parsing variadic arguments in ``class_`` and cpp_function 2708 * Fixed license text (was: ZLIB, should have been: 3-clause BSD) 2709 * Python 3.2 compatibility 2710 * Fixed remaining issues when accessing types in another plugin module 2711 * Added enum comparison and casting methods 2712 * Improved SFINAE-based detection of whether types are copy-constructible 2713 * Eliminated many warnings about unused variables and the use of ``offsetof()`` 2714 * Support for ``std::array<>`` conversions 2715 2716 1.1 (December 7, 2015) 2717 -------------------------- 2718 2719 * Documentation improvements (GIL, wrapping functions, casting, fixed many typos) 2720 * Generalized conversion of integer types 2721 * Improved support for casting function objects 2722 * Improved support for ``std::shared_ptr<>`` conversions 2723 * Initial support for ``std::set<>`` conversions 2724 * Fixed type resolution issue for types defined in a separate plugin module 2725 * CMake build system improvements 2726 * Factored out generic functionality to non-templated code (smaller code size) 2727 * Added a code size / compile time benchmark vs Boost.Python 2728 * Added an appveyor CI script 2729 2730 1.0 (October 15, 2015) 2731 ------------------------ 2732 * Initial release