The builtins module really should be called 'builtins'

This commit is contained in:
K. Lange 2022-08-04 05:58:22 +09:00
parent 879a26f3cf
commit 5d9d33e10e
4 changed files with 6 additions and 6 deletions

View File

@ -198,7 +198,7 @@ KRK_Method(object,__str__) {
KrkValue qualname = NONE_VAL();
krk_tableGet(&type->methods, OBJECT_VAL(S("__qualname__")), &qualname);
KrkString * name = IS_STRING(qualname) ? AS_STRING(qualname) : type->name;
int includeModule = !(IS_NONE(module) || (IS_STRING(module) && AS_STRING(module) == S("__builtins__")));
int includeModule = !(IS_NONE(module) || (IS_STRING(module) && AS_STRING(module) == S("builtins")));
size_t allocSize = sizeof("<. object at 0x1234567812345678>") + name->length;
if (includeModule) allocSize += AS_STRING(module)->length + 1;
@ -1249,12 +1249,12 @@ void _createAndBind_builtins(void) {
KRK_DOC(module, "Type of imported modules and packages.");
vm.builtins = krk_newInstance(module);
krk_attachNamedObject(&vm.modules, "__builtins__", (KrkObj*)vm.builtins);
krk_attachNamedObject(&vm.modules, "builtins", (KrkObj*)vm.builtins);
krk_attachNamedObject(&vm.builtins->fields, "object", (KrkObj*)vm.baseClasses->objectClass);
krk_pop();
krk_pop();
krk_attachNamedObject(&vm.builtins->fields, "__name__", (KrkObj*)S("__builtins__"));
krk_attachNamedObject(&vm.builtins->fields, "__name__", (KrkObj*)S("builtins"));
krk_attachNamedValue(&vm.builtins->fields, "__file__", NONE_VAL());
KRK_DOC(vm.builtins,
"@brief Internal module containing built-in functions and classes.\n\n"

View File

@ -307,7 +307,7 @@ static void dumpInnerException(KrkValue exception, int depth) {
KrkClass * type = krk_getType(exception);
KrkValue module = NONE_VAL();
krk_tableGet(&type->methods, OBJECT_VAL(S("__module__")), &module);
if (!(IS_NONE(module) || (IS_STRING(module) && AS_STRING(module) == S("__builtins__")))) {
if (!(IS_NONE(module) || (IS_STRING(module) && AS_STRING(module) == S("builtins")))) {
fprintf(stderr, "%s.", AS_CSTRING(module));
}

View File

@ -60,7 +60,7 @@ KRK_Method(type,__str__) {
krk_tableGet(&self->methods, OBJECT_VAL(S("__qualname__")), &qualname);
KrkString * name = IS_STRING(qualname) ? AS_STRING(qualname) : self->name;
int includeModule = !(IS_NONE(module) || (IS_STRING(module) && AS_STRING(module) == S("__builtins__")));
int includeModule = !(IS_NONE(module) || (IS_STRING(module) && AS_STRING(module) == S("builtins")));
size_t allocSize = sizeof("<class ''>") + name->length;
if (IS_STRING(module)) allocSize += AS_STRING(module)->length + 1;

View File

@ -99,7 +99,7 @@ class Pair():
let modules = [
# Integrated stuff
'__builtins__',
'builtins',
'os',
'kuroko',
'math',