From c89a38fe9d2cdbcac7b7c88b75fa22360c343e78 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sun, 26 Feb 2023 19:30:07 +0800 Subject: [PATCH] Update obj.h --- src/obj.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/obj.h b/src/obj.h index 7c4e19cd..4014b9a2 100644 --- a/src/obj.h +++ b/src/obj.h @@ -149,7 +149,11 @@ inline bool is_float(const PyVar& obj) noexcept { } #define PY_CLASS(mod, name) \ - inline static Type _type(VM* vm) { return OBJ_GET(Type, vm->_modules[#mod]->attr(#name)); } \ + inline static Type _type(VM* vm) { \ + static StrName __x0(#mod); \ + static StrName __x1(#name); \ + return OBJ_GET(Type, vm->_modules[__x0]->attr(__x1)); \ + } \ inline static const char* _mod() { return #mod; } \ inline static const char* _name() { return #name; }