From 99195ac4904b4043d830c93002f6e9eb991fd16b Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Fri, 26 Apr 2024 16:35:54 +0800 Subject: [PATCH] fix `dict.__init__` --- src/pocketpy.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pocketpy.cpp b/src/pocketpy.cpp index b95d54ab..fb2846e5 100644 --- a/src/pocketpy.cpp +++ b/src/pocketpy.cpp @@ -1283,13 +1283,14 @@ void init_builtins(VM* _vm) { for(PyObject* item : list){ Tuple& t = CAST(Tuple&, item); if(t.size() != 2){ - vm->ValueError("dict() takes an iterable of tuples (key, value)"); + vm->ValueError("dict() takes a list of tuples (key, value)"); return vm->None; } self.set(t[0], t[1]); } + return vm->None; } - return vm->None; + vm->TypeError("dict() takes a dictionary or a list of tuples"); } vm->TypeError("dict() takes at most 1 argument"); PK_UNREACHABLE()