Commit f9812cf8 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Misc things to try to get the warnings module to work

parent e6103a1b
......@@ -371,7 +371,7 @@ BoxedModule* builtins_module;
// TODO looks like CPython and pypy put this into an "exceptions" module:
BoxedClass* Exception, *AssertionError, *AttributeError, *TypeError, *NameError, *KeyError, *IndexError, *IOError,
*OSError, *ZeroDivisionError, *ValueError, *UnboundLocalError, *RuntimeError, *ImportError, *StopIteration;
*OSError, *ZeroDivisionError, *ValueError, *UnboundLocalError, *RuntimeError, *ImportError, *StopIteration, *Warning;
const ObjectFlavor exception_flavor(&boxGCHandler, NULL);
Box* exceptionNew1(BoxedClass* cls) {
......@@ -459,6 +459,9 @@ void setupBuiltins() {
RuntimeError = makeBuiltinException(Exception, "RuntimeError");
ImportError = makeBuiltinException(Exception, "ImportError");
StopIteration = makeBuiltinException(Exception, "StopIteration");
Warning = makeBuiltinException(Exception, "Warning");
/*ImportWarning =*/ makeBuiltinException(Warning, "ImportWarning");
/*PendingDeprecationWarning =*/ makeBuiltinException(Warning, "PendingDeprecationWarning");
repr_obj = new BoxedFunction(boxRTFunction((void*)repr, UNKNOWN, 1));
builtins_module->giveAttr("repr", repr_obj);
......
......@@ -87,6 +87,9 @@ void setupSys() {
sys_module->giveAttr("stdout", new BoxedFile(stdout));
sys_module->giveAttr("stdin", new BoxedFile(stdin));
sys_module->giveAttr("stderr", new BoxedFile(stderr));
sys_module->giveAttr("warnoptions", new BoxedList());
sys_module->giveAttr("py3kwarning", False);
}
void setupSysEnd() {
......
......@@ -75,6 +75,8 @@ extern "C" BoxedFunction::BoxedFunction(CLFunction* f)
this->giveAttr("__module__", modname);
}
this->giveAttr("__doc__", None);
assert(f->num_defaults == ndefaults);
}
......@@ -97,6 +99,8 @@ extern "C" BoxedFunction::BoxedFunction(CLFunction* f, std::initializer_list<Box
this->giveAttr("__module__", modname);
}
this->giveAttr("__doc__", None);
assert(f->num_defaults == ndefaults);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment