Ticket #578 (closed defect: fixed)

Opened 4 years ago

Last modified 3 years ago

crash in Py3 with non-sliceable slices

Reported by: robertwb Owned by: scoder
Priority: critical Milestone: 0.14
Component: Code Generation Keywords:
Cc:

Description

I believe

range(10)[1:2]

is enough to trigger it.

Change History

Changed 4 years ago by robertwb

  • priority changed from major to critical

Changed 4 years ago by scoder

I tried cythonising

range(10)[1:2]
1[2:3]

which generates a C file without crashing the compiler. However, when I run it, I get a crash in PySequence_GetSlice() on the following code:

    mp = s->ob_type->tp_as_mapping;
    if (mp->mp_subscript) {

The mp pointer is NULL. Clearly a bug in CPython, introduced in the Py3 series.

 http://bugs.python.org/issue9834

Changed 4 years ago by scoder

  • summary changed from compiler crash in Py3 with non-sliceable slices to crash in Py3 with non-sliceable slices

As a workaround, we could replace the calls to PySequence_GetSlice by a macro call that expands to an additional s->ob_type->tp_as_mapping check before the call for the affected CPython versions. Let's expect this to be fixed in the next official releases.

Changed 3 years ago by scoder

  • owner changed from somebody to scoder
  • status changed from new to assigned

Changed 3 years ago by scoder

  • status changed from assigned to closed
  • resolution set to fixed
  • milestone changed from wishlist to 0.13.1

Bug will be fixed in releases after CPython 3.1.2, Cython work-around is implemented here:

 http://hg.cython.org/cython-devel/rev/142faf1058ff

Note: See TracTickets for help on using tickets.