self.assertEqual(func(min_val - 1), (-1, -1))
self.assertEqual(func(max_val + 1), (-1, +1))
-
- # CRASHES func(1.0)
- # CRASHES func(NULL)
+ self.assertRaises(SystemError, func, None)
+ self.assertRaises(TypeError, func, 1.0)
def test_long_asint(self):
# Test PyLong_AsInt()
int overflow = UNINITIALIZED_INT;
long value = PyLong_AsLongAndOverflow(arg, &overflow);
if (value == -1 && PyErr_Occurred()) {
- assert(overflow == -1);
+ assert(overflow == 0);
return NULL;
}
return Py_BuildValue("li", value, overflow);
int overflow = UNINITIALIZED_INT;
long long value = PyLong_AsLongLongAndOverflow(arg, &overflow);
if (value == -1 && PyErr_Occurred()) {
- assert(overflow == -1);
+ assert(overflow == 0);
return NULL;
}
return Py_BuildValue("Li", value, overflow);