diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1ec1f1d53..f61011d54 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -60,7 +60,7 @@ system with CMake 3.14+: python3 -m venv venv source venv/bin/activate pip install -r tests/requirements.txt -cmake -S . -B build -DPYTHON_EXECUTABLE=$(which python) -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=ON +cmake -S . -B build -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=ON cmake --build build -j4 ``` @@ -71,9 +71,10 @@ Tips: * You can select any name for your environment folder; if it contains "env" it will be ignored by git. * If you don’t have CMake 3.14+, just add “cmake” to the pip install command. -* You can use `-DPYBIND11_FINDPYTHON=ON` instead of setting the - `PYTHON_EXECUTABLE` - the new search algorithm can find virtual environments, - Conda, and more. +* You can use `-DPYBIND11_FINDPYTHON=ON` to use FindPython on CMake 3.12+ +* In classic mode, you may need to set `-DPYTHON_EXECUTABLE=/path/to/python`. + FindPython uses `-DPython_ROOT_DIR=/path/to` or + `-DPython_EXECUTABLE=/path/to/python`. ### Configuration options @@ -104,10 +105,12 @@ The valid options are: * Use `cmake build -LH` to list the CMake options with help. * Use `ccmake` if available to see a curses (terminal) gui, or `cmake-gui` for a completely graphical interface (not present in the PyPI package). -* Use `-G` and the name of a generator to use something different, like `Ninja` - (automatic multithreading!). `cmake --help` lists the generators available. -* Open the `CMakeLists.txt` with QtCreator to generate for that IDE. * Use `cmake --build build -j12` to build with 12 cores (for example). +* Use `-G` and the name of a generator to use something different. `cmake + --help` lists the generators available. + - On Unix, setting `CMAKE_GENERATER=Ninja` in your environment will give + you automatic mulithreading on all your CMake projects! +* Open the `CMakeLists.txt` with QtCreator to generate for that IDE. * You can use `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` to generate the `.json` file that some tools expect. diff --git a/docs/advanced/classes.rst b/docs/advanced/classes.rst index e8940d814..f7db3eadf 100644 --- a/docs/advanced/classes.rst +++ b/docs/advanced/classes.rst @@ -149,8 +149,7 @@ memory for the C++ portion of the instance will be left uninitialized, which will generally leave the C++ instance in an invalid state and cause undefined behavior if the C++ instance is subsequently used. -.. versionadded:: 2.5.1 - +.. versionchanged:: 2.6 The default pybind11 metaclass will throw a ``TypeError`` when it detects that ``__init__`` was not called by a derived class. @@ -597,6 +596,8 @@ For more information, see :ref:`the documentation on exceptions `_ + +* Perfect forwarding support for methods. + `#2048 `_ + +* Added ``py::error_already_set::discard_as_unraisable()``. + `#2372 `_ + +* ``py::hash`` is now public. + `#2217 `_ + +* ``py::is_final()`` class modifier to block subclassing (CPython only). + `#2151 `_ + +* ``py::memoryview`` update and documentation. + `#2223 `_ + * Minimum CMake required increased to 3.4. `#2338 `_ and `#2370 `_ @@ -36,6 +54,39 @@ See :ref:`upgrade-guide-2.6` for help upgrading to the new version. `#2265 `_ and `#2346 `_ +Smaller or developer focused features: + +* Error now thrown when ``__init__`` is forgotten on subclasses. + `#2152 `_ + +* If ``__eq__`` defined but not ``__hash__``, ``__hash__`` is now set to + ``None``. + `#2291 `_ + +* ``py::ellipsis`` now also works on Python 2 + `#2360 `_ + +* Added missing signature for ``py::array`` + `#2363 `_ + +* Bugfixes related to more extensive testing + `#2321 `_ + +* Pointer to ``std::tuple`` & ``std::pair`` supported in cast. + `#2334 `_ + +* Small fixes in NumPy support. ``py::array`` now uses ``py::ssize_t`` as first + argument type. + `#2293 `_ + +* PyPy fixes, including support for PyPy3 and PyPy 7. + `#2146 `_ + +* CPython 3.9 fixes. + `#2253 `_ + +* Debug Python interpreter support. + `#2025 `_ diff --git a/docs/upgrade.rst b/docs/upgrade.rst index 98285eb6e..7c3f1c328 100644 --- a/docs/upgrade.rst +++ b/docs/upgrade.rst @@ -13,6 +13,14 @@ modernization and other useful information. v2.6 ==== +An error is now thrown when ``__init__`` is forgotten on subclasses. This was +incorrect before, but was not checked. Add a call to ``__init__`` if it is +missing. + +If ``__eq__`` defined but not ``__hash__``, ``__hash__`` is now set to +``None``, as in normal CPython. You should add ``__hash__`` if you intended the +class to be hashable, possibly using the new ``py::hash`` shortcut. + CMake support: --------------