From: Stefan Behnel Date: Sat, 16 Mar 2013 16:09:40 +0000 (+0100) Subject: fix passing explicit None slice indices into the getslice code, enable test case... X-Git-Tag: 0.19b1~43 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a26af45598824c00274d9df90921005f19f36ad;p=platform%2Fupstream%2Fpython-cython.git fix passing explicit None slice indices into the getslice code, enable test case for ticket 636 --HG-- rename : tests/run/slice2_T636.pyx => tests/run/slice2_T636.py --- diff --git a/Cython/Utility/ObjectHandling.c b/Cython/Utility/ObjectHandling.c index 3d3729a..594624c 100644 --- a/Cython/Utility/ObjectHandling.c +++ b/Cython/Utility/ObjectHandling.c @@ -463,14 +463,14 @@ static CYTHON_INLINE PyObject* __Pyx_PySequence_GetObjectSlice( PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; if (likely(ms && ms->sq_slice)) { if (!has_cstart) { - if (_py_start) { + if (_py_start && (*_py_start != Py_None)) { cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) return NULL; } else cstart = 0; } if (!has_cstop) { - if (_py_stop) { + if (_py_stop && (*_py_stop != Py_None)) { cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) return NULL; } else @@ -565,14 +565,14 @@ static CYTHON_INLINE int __Pyx_PySequence_SetObjectSlice( PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; if (likely(ms && ms->sq_ass_slice)) { if (!has_cstart) { - if (_py_start) { + if (_py_start && (*_py_start != Py_None)) { cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) return -1; } else cstart = 0; } if (!has_cstop) { - if (_py_stop) { + if (_py_stop && (*_py_stop != Py_None)) { cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) return -1; } else diff --git a/tests/bugs.txt b/tests/bugs.txt index f368fcc..dd84610 100644 --- a/tests/bugs.txt +++ b/tests/bugs.txt @@ -11,7 +11,6 @@ genexpr_iterable_lookup_T600 generator_expressions_in_class for_from_pyvar_loop_T601 temp_sideeffects_T654 # not really a bug, Cython warns about it -slice2_T636 inherited_final_method tryfinallychaining # also see FIXME in "yield_from_pep380" test diff --git a/tests/run/slice2_T636.pyx b/tests/run/slice2_T636.py similarity index 100% rename from tests/run/slice2_T636.pyx rename to tests/run/slice2_T636.py