From a9376bd80f4b103f5aba0d22b65cacb4bb3d2382 Mon Sep 17 00:00:00 2001 From: szdytom Date: Tue, 11 Jun 2024 17:45:31 +0800 Subject: [PATCH] fix empty function name handling --- .gitignore | 1 + include/pocketpy/objects/sourcedata.hpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 57d60653..ce195c89 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ main.dSYM/ docs/references.md .xmake +.vs diff --git a/include/pocketpy/objects/sourcedata.hpp b/include/pocketpy/objects/sourcedata.hpp index 96b716f9..141ef54f 100644 --- a/include/pocketpy/objects/sourcedata.hpp +++ b/include/pocketpy/objects/sourcedata.hpp @@ -70,7 +70,7 @@ struct SourceData { } Str snapshot(int lineno, const char* cursor, std::string_view name) const { - return pkpy_SourceData__snapshot(self, lineno, cursor, name.data()); + return pkpy_SourceData__snapshot(self, lineno, cursor, name.empty() ? nullptr : name.data()); } ~SourceData() {