Commit 02c39c34 authored by Marius Wachtler's avatar Marius Wachtler

Add chr(long)

parent d5356e46
...@@ -350,10 +350,10 @@ Box* open(Box* arg1, Box* arg2) { ...@@ -350,10 +350,10 @@ Box* open(Box* arg1, Box* arg2) {
} }
extern "C" Box* chr(Box* arg) { extern "C" Box* chr(Box* arg) {
if (arg->cls != int_cls) { i64 n = PyInt_AsLong(arg);
if (n == -1 && PyErr_Occurred())
raiseExcHelper(TypeError, "an integer is required"); raiseExcHelper(TypeError, "an integer is required");
}
i64 n = static_cast<BoxedInt*>(arg)->n;
if (n < 0 || n >= 256) { if (n < 0 || n >= 256) {
raiseExcHelper(ValueError, "chr() arg not in range(256)"); raiseExcHelper(ValueError, "chr() arg not in range(256)");
} }
......
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