From e83f3ebbc7cf27c96d0daa0c81029dd4c7ee4d00 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 28 Feb 2025 20:22:36 -0800 Subject: [PATCH] Suggest smart_holder for "most situations for safety" --- docs/advanced/smart_ptrs.rst | 10 ++++++---- docs/classes.rst | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/advanced/smart_ptrs.rst b/docs/advanced/smart_ptrs.rst index 74441d9016..599f384db0 100644 --- a/docs/advanced/smart_ptrs.rst +++ b/docs/advanced/smart_ptrs.rst @@ -31,10 +31,12 @@ simply add ``py::smart_holder`` to ``py::class_``: .. note:: - A shorthand, ``py::classh``, is provided for ``py::class_``. The ``h`` in ``py::classh`` comes from - **smart_holder** but is condensed for brevity; it is the same number of - characters as ``py::class_``. + A shorthand, ``py::classh``, is provided for + ``py::class_``. The ``h`` in ``py::classh`` stands + for **smart_holder** but is shortened for brevity, ensuring it has the + same number of characters as ``py::class_``. This design choice facilitates + easy experimentation with ``py::smart_holder`` without introducing + distracting whitespace noise in diffs. The ``py::smart_holder`` functionality includes the following: diff --git a/docs/classes.rst b/docs/classes.rst index 07aded277e..5406668f0b 100644 --- a/docs/classes.rst +++ b/docs/classes.rst @@ -42,8 +42,8 @@ constructor (see the :ref:`custom_constructors` section for details). .. note:: Starting with pybind11v3, it is recommended to include `py::smart_holder` - if you plan to support conversions to C++ smart pointers. See - :ref:`smart_holder` for more information. + in most situations for safety, especially if you plan to support conversions + to C++ smart pointers. See :ref:`smart_holder` for more information. An interactive Python session demonstrating this example is shown below: