OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jira] [Created] (ARROW-3227) [Python] NativeFile.write shouldn't accept unicode strings


Antoine Pitrou created ARROW-3227:
-------------------------------------

             Summary: [Python] NativeFile.write shouldn't accept unicode strings
                 Key: ARROW-3227
                 URL: https://issues.apache.org/jira/browse/ARROW-3227
             Project: Apache Arrow
          Issue Type: Bug
          Components: Python
    Affects Versions: 0.10.0
            Reporter: Antoine Pitrou


Arrow files are binary, but for some reason {{NativeFile.write}} silently converts unicode strings to bytes.
{code:python}
>>> b = io.BytesIO()
>>> b.write("foo")
Traceback (most recent call last):
  File "<ipython-input-6-a7195dbc0372>", line 1, in <module>
    b.write("foo")

TypeError: a bytes-like object is required, not 'str'
>>> f = pa.PythonFile(b)
>>> f.write("foo")
>>> b.getvalue()
b'foo'
>>> f.write("😀")
>>> b.getvalue()
b'foo\xf0\x9f\x98\x80'
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)