Commit c6788275 authored by Marius Wachtler's avatar Marius Wachtler

PySequence_DelItem, support for 'L' and 'K' inside do_mkvalue, PyNumber_Long(int)

parent f6a8e880
......@@ -1879,6 +1879,9 @@ extern "C" PyObject* PyNumber_Long(PyObject* o) noexcept {
if (o->cls == float_cls)
return PyLong_FromDouble(PyFloat_AsDouble(o));
if (o->cls == int_cls)
return PyLong_FromLong(((BoxedInt*)o)->n);
fatalOrError(PyExc_NotImplementedError, "unimplemented");
return nullptr;
}
......
......@@ -184,6 +184,13 @@ static PyObject* do_mkvalue(const char** p_format, va_list* p_va, int flags) noe
}
return v;
}
#ifdef HAVE_LONG_LONG
case 'L':
return PyLong_FromLongLong((PY_LONG_LONG)va_arg(*p_va, PY_LONG_LONG));
case 'K':
return PyLong_FromUnsignedLongLong((PY_LONG_LONG)va_arg(*p_va, unsigned PY_LONG_LONG));
#endif
#ifdef Py_USING_UNICODE
case 'u': {
PyObject* v;
......
......@@ -461,8 +461,14 @@ extern "C" int PySequence_SetItem(PyObject* o, Py_ssize_t i, PyObject* v) noexce
}
extern "C" int PySequence_DelItem(PyObject* o, Py_ssize_t i) noexcept {
fatalOrError(PyExc_NotImplementedError, "unimplemented");
return -1;
try {
// Not sure if this is really the same:
delitem(o, boxInt(i));
return 0;
} catch (ExcInfo e) {
setCAPIException(e);
return -1;
}
}
extern "C" int PySequence_SetSlice(PyObject* o, Py_ssize_t i1, Py_ssize_t i2, PyObject* v) noexcept {
......
......@@ -4165,7 +4165,7 @@ Box* typeNew(Box* _cls, Box* arg1, Box* arg2, Box** _args) {
return rtn;
}
RELEASE_ASSERT(arg3->cls == dict_cls, "%s", getTypeName(arg3));
RELEASE_ASSERT(PyDict_Check(arg3), "%s", getTypeName(arg3));
BoxedDict* attr_dict = static_cast<BoxedDict*>(arg3);
RELEASE_ASSERT(arg2->cls == tuple_cls, "");
......
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