SIGN IN SIGN UP

Fix lifetime issue of PyBundledModule bytes object (#1108)

Summary:
Pull Request resolved: https://github.com/pytorch/executorch/pull/1108

The PyBundledModule stores a raw pointer into a buffer, but the problem is that
there's no guarantee that the input `py::bytes` object is still alive later when the
PyBundledModule is used, leading to an ASAN error.

Fix this by storing a refcounted `py::bytes` object instead of a raw pointer in the
mirrored C++ object. This will prevent the refcount from going to zero while the
PyBundledModule object is still alive.

Reviewed By: JacobSzwejbka

Differential Revision: D50670477

fbshipit-source-id: 3de4f5c2eee125a2d9552bc206d2091bf4879e84
R
Riley Dulin committed
ec4868ae3ea381dc17ff617c74b9fd761f8e69e1
Parent: 66fdef6
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 10/27/2023, 9:05:02 PM