From 81c6b43e00735f3f7d6c268c69539880745da43d Mon Sep 17 00:00:00 2001 From: ahgamut <41098605+ahgamut@users.noreply.github.com> Date: Fri, 5 Nov 2021 03:12:52 +0530 Subject: [PATCH] all tests pass in MODE=dbg --- third_party/python/Python/bltinmodule.c | 7 +++++++ third_party/python/Python/getargs.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/third_party/python/Python/bltinmodule.c b/third_party/python/Python/bltinmodule.c index 77b763036..d1241d6a7 100644 --- a/third_party/python/Python/bltinmodule.c +++ b/third_party/python/Python/bltinmodule.c @@ -348,6 +348,13 @@ builtin___build_class__(PyObject *self, PyObject **args, Py_ssize_t nargs, Py_DECREF(bases); return NULL; } + if (!PyMapping_Check(ns)) { + PyErr_Format(PyExc_TypeError, + "%.200s.__prepare__() must return a mapping, not %.200s", + isclass ? ((PyTypeObject *)meta)->tp_name : "", + Py_TYPE(ns)->tp_name); + goto error; + } cell = PyEval_EvalCodeEx(PyFunction_GET_CODE(func), PyFunction_GET_GLOBALS(func), ns, NULL, 0, NULL, 0, NULL, 0, NULL, PyFunction_GET_CLOSURE(func)); diff --git a/third_party/python/Python/getargs.c b/third_party/python/Python/getargs.c index b6f95f985..0c14dba00 100644 --- a/third_party/python/Python/getargs.c +++ b/third_party/python/Python/getargs.c @@ -1789,7 +1789,7 @@ parser_init(struct _PyArg_Parser *parser) PyObject *kwtuple; assert(parser->format != NULL); - assert(parser->kwargs != NULL); + assert(parser->keywords != NULL); if (parser->kwtuple != NULL) { return 1; }