Skip to content

PyBytesWriter_GetData should mention that PyBytesWriter_Resize can also invalidate the returned pointer #146353

@cdhowie

Description

@cdhowie

Documentation

See relevant discussion on PyO3/pyo3#5906 and the discussion linked from that.

PyBytesWriter_Resize may need to reallocate the buffer to grow it. If this happens, any pointer previously returned by PyBytesWriter_GetData will be invalidated, but this is not documented -- only PyBytesWriter_Finish and PyBytesWriter_Discard are documented to invalidate previous data pointers.

I am happy to submit a PR for this issue if that would be helpful. (I assume I only need to modify Doc/c-api/bytes.rst?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions