aboutsummaryrefslogtreecommitdiff
path: root/docs/upgrade.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/upgrade.rst')
-rw-r--r--docs/upgrade.rst58
1 files changed, 56 insertions, 2 deletions
diff --git a/docs/upgrade.rst b/docs/upgrade.rst
index f13fbcf5..b13d21f5 100644
--- a/docs/upgrade.rst
+++ b/docs/upgrade.rst
@@ -8,6 +8,60 @@ to a new version. But it goes into more detail. This includes things like
deprecated APIs and their replacements, build system changes, general code
modernization and other useful information.
+.. _upgrade-guide-2.11:
+
+v2.11
+=====
+
+* The minimum version of CMake is now 3.5. A future version will likely move to
+ requiring something like CMake 3.15. Note that CMake 3.27 is removing the
+ long-deprecated support for ``FindPythonInterp`` if you set 3.27 as the
+ minimum or maximum supported version. To prepare for that future, CMake 3.15+
+ using ``FindPython`` or setting ``PYBIND11_FINDPYTHON`` is highly recommended,
+ otherwise pybind11 will automatically switch to using ``FindPython`` if
+ ``FindPythonInterp`` is not available.
+
+
+.. _upgrade-guide-2.9:
+
+v2.9
+====
+
+* Any usage of the recently added ``py::make_simple_namespace`` should be
+ converted to using ``py::module_::import("types").attr("SimpleNamespace")``
+ instead.
+
+* The use of ``_`` in custom type casters can now be replaced with the more
+ readable ``const_name`` instead. The old ``_`` shortcut has been retained
+ unless it is being used as a macro (like for gettext).
+
+
+.. _upgrade-guide-2.7:
+
+v2.7
+====
+
+*Before* v2.7, ``py::str`` can hold ``PyUnicodeObject`` or ``PyBytesObject``,
+and ``py::isinstance<str>()`` is ``true`` for both ``py::str`` and
+``py::bytes``. Starting with v2.7, ``py::str`` exclusively holds
+``PyUnicodeObject`` (`#2409 <https://github.com/pybind/pybind11/pull/2409>`_),
+and ``py::isinstance<str>()`` is ``true`` only for ``py::str``. To help in
+the transition of user code, the ``PYBIND11_STR_LEGACY_PERMISSIVE`` macro
+is provided as an escape hatch to go back to the legacy behavior. This macro
+will be removed in future releases. Two types of required fixes are expected
+to be common:
+
+* Accidental use of ``py::str`` instead of ``py::bytes``, masked by the legacy
+ behavior. These are probably very easy to fix, by changing from
+ ``py::str`` to ``py::bytes``.
+
+* Reliance on py::isinstance<str>(obj) being ``true`` for
+ ``py::bytes``. This is likely to be easy to fix in most cases by adding
+ ``|| py::isinstance<bytes>(obj)``, but a fix may be more involved, e.g. if
+ ``py::isinstance<T>`` appears in a template. Such situations will require
+ careful review and custom fixes.
+
+
.. _upgrade-guide-2.6:
v2.6
@@ -256,7 +310,7 @@ Within pybind11's CMake build system, ``pybind11_add_module`` has always been
setting the ``-fvisibility=hidden`` flag in release mode. From now on, it's
being applied unconditionally, even in debug mode and it can no longer be opted
out of with the ``NO_EXTRAS`` option. The ``pybind11::module`` target now also
-adds this flag to it's interface. The ``pybind11::embed`` target is unchanged.
+adds this flag to its interface. The ``pybind11::embed`` target is unchanged.
The most significant change here is for the ``pybind11::module`` target. If you
were previously relying on default visibility, i.e. if your Python module was
@@ -484,7 +538,7 @@ include a declaration of the form:
PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>)
-Continuing to do so won’t cause an error or even a deprecation warning,
+Continuing to do so won't cause an error or even a deprecation warning,
but it's completely redundant.