Changes between Initial Version and Version 1 of Ticket #27598, comment 1


Ignore:
Timestamp:
04/02/19 21:57:27 (15 months ago)
Author:
jhpalmieri
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27598, comment 1

    initial v1  
    1 The problem is with the use of the `bytearray` function. With Sage built with Python 2:
     1The problem is with the use of the `bytearray` function. With Python 2:
    22{{{
    3 sage: bytearray('á')
     3>>> bytearray('á')
    44bytearray(b'\xc3\xa1')
    5 sage: bytearray('á', 'utf8')
    6 ---------------------------------------------------------------------------
    7 UnicodeDecodeError                        Traceback (most recent call last)
    8 <ipython-input-5-ed3cbd107e76> in <module>()
    9 ----> 1 bytearray('á', 'utf8')
    10 
     5>>> bytearray('á', 'utf8')
     6Traceback (most recent call last):
     7  File "<stdin>", line 1, in <module>
    118UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)
    129}}}
    13 With Sage built with Python 3:
     10With Python 3:
    1411{{{
    15 sage: bytearray('á')
    16 ---------------------------------------------------------------------------
    17 TypeError                                 Traceback (most recent call last)
    18 <ipython-input-1-c2017f20abfd> in <module>()
    19 ----> 1 bytearray('á')
    20 
     12>>> bytearray('á')
     13Traceback (most recent call last):
     14  File "<stdin>", line 1, in <module>
    2115TypeError: string argument without an encoding
    22 sage: bytearray('á', 'utf8')
     16>>> bytearray('á', 'utf8')
    2317bytearray(b'\xc3\xa1')
    2418}}}