Unhelpful AssertionError on comparing strings with unicode

Issue #1689 resolved
Wilfred Hughes
created an issue

From (bugs.pypy.org)

Comments (3)

  1. Wilfred Hughes reporter

    Upon compiling the attached file with RPython 2.2.1, I get an assertion error. It doesn't say what's wrong (comparing a string with a unicode) or which line caused the issue.

    The error traceback looks like this:

    [translation:info] File "/home/wilfred/projects/trifle/src/pypy/rpython/rtyper/rptr.py", line 115, in convert_from_to
    [translation:info] assert r_ptr1.lowleveltype == r_ptr2.lowleveltype
    

    Full traceback here: https://gist.github.com/Wilfred/8925923#file-error-txt

  2. Ronan Lamy
    That kind of user error should be caught earlier, in the annotation stage, where
    we already have the machinery in place to give sensible feedback to the user.
    More precisely, we should define the annotation of op.eq(<string>, <unicode>) to
    raise an AnnotationError.
    
    Also, this issue is an instance of a more general problem: we should define
    clearly RPython's behaviour when comparing objects of incompatible types.
    
  3. Log in to comment