From bcf51c453511b8cb68e72e532b1d723d4876b8e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E8=80=8C=E9=9D=99?= Date: Wed, 12 Jun 2024 11:29:38 +0800 Subject: [PATCH] Add the missing destructor for `SourceData` C++ binding (#267) --- include/pocketpy/objects/sourcedata.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/pocketpy/objects/sourcedata.hpp b/include/pocketpy/objects/sourcedata.hpp index 2295e294..a9b6ac19 100644 --- a/include/pocketpy/objects/sourcedata.hpp +++ b/include/pocketpy/objects/sourcedata.hpp @@ -11,6 +11,10 @@ struct SourceData : public pkpy_SourceData { pkpy_SourceData__ctor(this, source.data(), source.size(), &filename, mode); } + ~SourceData() { + pkpy_SourceData__dtor(this); + } + std::string_view get_line(int lineno) const { const char *st, *ed; if (pkpy_SourceData__get_line(this, lineno, &st, &ed)) {