Author: Vincent Legoll <vincent.leg...@idgrilles.fr>
Branch: fix-2211
Changeset: r81390:cdedb2bd7d06
Date: 2015-12-16 16:01 +0100
http://bitbucket.org/pypy/pypy/changeset/cdedb2bd7d06/

Log:    Fix 2211 : cryptic exception message

        At translation time, when attempting to use extended slicing in
        rpython, Exception message was cryptic and not really helpful:

        AttributeError: type object 'newslice' has no attribute
        'get_specialization'

        Now we have the following message, which points to the faulty line :

        [translation:ERROR] AnnotatorError: [translation:ERROR]
        [translation:ERROR] Cannot use extended slicing in rpython
        [translation:ERROR] [translation:ERROR] [translation:ERROR] v483 =
        newslice(v481, v482, step_0) [translation:ERROR] [translation:ERROR]
        In <FunctionGraph of
        (pypy.objspace.std.listobject:1457)FloatListStrategy.setslice at
        0x1c3b0720>: [translation:ERROR] Happened at file
        /home/vlegoll/repo/upstream/pypy-for-
        upstream2/pypy/objspace/std/listobject.py line 1524
        [translation:ERROR] [translation:ERROR] ==> items[start:start +
        slicelength:step] = other_items

diff --git a/rpython/flowspace/operation.py b/rpython/flowspace/operation.py
--- a/rpython/flowspace/operation.py
+++ b/rpython/flowspace/operation.py
@@ -508,6 +508,14 @@
                 *[annotator.annotation(arg) for arg in self.args])
 
 
+class NewSlice(HLOperation):
+    opname = 'newslice'
+    canraise = [AnnotatorError]
+
+    def get_specialization(self, s_arg1, s_arg2, s_arg3):
+        raise AnnotatorError("Cannot use extended slicing in rpython")
+
+
 class Pow(PureOperation):
     opname = 'pow'
     arity = 3
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to