Immortalize '__main__'

This commit is contained in:
K. Lange 2024-03-07 14:53:42 +09:00
parent 5345006580
commit 2ed41a0fb0
2 changed files with 2 additions and 4 deletions

View File

@ -942,10 +942,7 @@ _finishArgs:
"provide color highlighting of the input line.");
if (moduleAsMain) {
krk_push(OBJECT_VAL(krk_copyString("__main__",8)));
int out = !krk_importModule(
AS_STRING(AS_LIST(argList)->values[0]),
AS_STRING(krk_peek(0)));
int out = !krk_importModule(AS_STRING(AS_LIST(argList)->values[0]), S("__main__"));
if (krk_currentThread.flags & KRK_THREAD_HAS_EXCEPTION) {
krk_dumpTraceback();
krk_resetStack();

View File

@ -68,3 +68,4 @@ SPECIAL_ATTRS(BIN, "__bin__")
SPECIAL_ATTRS(ABS, "__abs__")
SPECIAL_ATTRS(FUNC, "__func__")
SPECIAL_ATTRS(BLDCLS, "__build_class__")
SPECIAL_ATTRS(MAIN, "__main__")