mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 08:03:55 +00:00
cca4c51ca4
`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. |
||
---|---|---|
.. | ||
cast | ||
pycpp | ||
classes.rst | ||
embedding.rst | ||
exceptions.rst | ||
functions.rst | ||
misc.rst | ||
smart_ptrs.rst |