pybind11/docs/advanced
Tim Stumbaugh cca4c51ca4
Update errors in string "Explicit conversions" docs (#4658)
`PyUnicode_DecodeLatin1` requires you to pass in the `error`
parameter. The code as it is in the docs didn't compile.

There is a reference leak in the example
code. `PyUnicode_DecodeLatin1` returns a new reference. Calling
`py::str(PyObject*)` calls `PyObject_Str`, which also returns a new
reference. That reference is managed by the `py::str`
constructor (which correctly steals the reference, using the
`stolen_t` constructor), but the original reference returned by
`PyUnicode_DecodeLatin1` is never decref'd: it never makes it into an
`object`, and it's never manually decremented.

This fixes both of those issues. The code compiles, and I viewed the
sphinx docs locally.
2023-05-09 07:04:20 -07:00
..
cast Update errors in string "Explicit conversions" docs (#4658) 2023-05-09 07:04:20 -07:00
pycpp docs: Missing semicolons (#4094) 2022-07-27 10:41:57 -07:00
classes.rst Open pybind11 namespace with consistent visility. (#4098) 2022-08-01 11:31:31 -07:00
embedding.rst maint: Add additional linter-related pre-commit hooks (#3337) 2021-10-08 08:38:04 -04:00
exceptions.rst fix: define (non-empty) `PYBIND11_EXPORT_EXCEPTION` only under macOS. (#4298) 2022-10-31 13:36:26 -04:00
functions.rst chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
misc.rst fix: improve the error reporting for inc_ref GIL failures (#4427) 2022-12-30 13:46:55 -05:00
smart_ptrs.rst Open pybind11 namespace with consistent visility. (#4098) 2022-08-01 11:31:31 -07:00