Ticket #7377: trac_7377-unicode_to_ecl-p1.patch

File trac_7377-unicode_to_ecl-p1.patch, 763 bytes (added by jpflori, 8 years ago)

Simpler patch not to slow exception propagation.

  • sage/libs/ecl.pyx

    # HG changeset patch
    # User Jean-Pierre Flori <flori@enst.fr>
    # Date 1299059470 -3600
    # Node ID d63ed2bc06f3757a70ca54179032ba6ef92f0d03
    # Parent  ddf7ef006e3a7b2d95f62bbea8624888ed8256c7
    Convert unicode to str before conversion to ecl_object
    
    diff -r ddf7ef006e3a -r d63ed2bc06f3 sage/libs/ecl.pyx
    a b  
    284284            return string_to_object(s)
    285285    elif isinstance(pyobj,float):
    286286        return ecl_make_doublefloat(pyobj)
     287    elif isinstance(pyobj,unicode):
     288        s=<bytes>(str(pyobj))
     289        return ecl_safe_read_string(s)       
    287290    elif isinstance(pyobj,bytes):
    288291        s=<bytes>pyobj
    289292        return ecl_safe_read_string(s)