Commit 2294c2a7 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #900 from Daetalus/test_operator

Implment some PyNumber_XXX function, to enable "test_operator"
parents f96c49ab 5bacdd4b
# expected: fail
import operator
import unittest
......
This diff is collapsed.
......@@ -567,7 +567,7 @@ extern "C" int PyObject_IsTrue(PyObject* o) noexcept {
try {
return o->nonzeroIC();
} catch (ExcInfo e) {
fatalOrError(PyExc_NotImplementedError, "unimplemented");
setCAPIException(e);
return -1;
}
}
......
......@@ -490,6 +490,9 @@ static inline void listSetitemSliceInt64(BoxedList* self, i64 start, i64 stop, i
v_size = 0;
v_elts = NULL;
} else {
if (self == v) // handle self assignment by creating a copy
v = _listSlice(self, 0, self->size, 1, self->size);
v_as_seq = RootedBox(PySequence_Fast(v, "can only assign an iterable"));
if (v_as_seq == NULL)
throwCAPIException();
......@@ -502,9 +505,6 @@ static inline void listSetitemSliceInt64(BoxedList* self, i64 start, i64 stop, i
v_elts = NULL;
}
if (self == v) // handle self assignment by creating a copy
v = _listSlice(self, 0, self->size, 1, self->size);
int delts = v_size - (stop - start);
int remaining_elts = self->size - stop;
self->ensure(delts);
......
......@@ -54,7 +54,6 @@ test_list longs as slice indices
test_long sys.long_info
test_module unicode docstrings
test_mutants unknown failure
test_operator PyNumber_Absolute()
test_optparse assertion instead of exceptions for long("invalid number")
test_pep277 segfaults
test_pep352 various unique bugs
......
......@@ -20,3 +20,6 @@ for op in sorted(dir(operator)):
if op.startswith("_"):
continue
print getattr(operator, op).__name__
a = range(4)
operator.setitem(a, 1, 3)
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