Issue2011

classification
Title: binascii doesn't work with bytearray and memoryview types
Type: crash Severity: normal
Components: Core, Library Versions: Jython 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: amak, fwierzbicki, indra, irmen, jeff.allen, mkz, santa4nt, zyasoft
Priority: Keywords:

Created on 2013-01-20.14:33:49 by irmen, last changed 2014-05-10.15:38:25 by zyasoft.

Messages
msg7584 (view) Author: Irmen de Jong (irmen) Date: 2013-01-20.14:33:46
binascii doesn't work with bytearray and memoryview types:

>>> import binascii
>>>
>>> binascii.b2a_base64(bytearray(b"hello"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: b2a_base64(): 1st arg can't be coerced to String
>>>
>>> binascii.b2a_base64(memoryview(b"hello"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: b2a_base64(): 1st arg can't be coerced to String
>>>


The above does work correctly in cPython 2.7
msg8136 (view) Author: Jeff Allen (jeff.allen) Date: 2013-09-29.21:44:36
Analysis: The binascii functions should be made to accept objects bearing the buffer interface: that would probably fix it. test_binascii currently stands disabled in regrtest.
msg8327 (view) Author: Jim Baker (zyasoft) Date: 2014-05-04.20:12:01
I re-enabled test_binascii in trunk to make this visible
msg8368 (view) Author: Indra Talip (indra) Date: 2014-05-10.06:01:24
Pull request at https://bitbucket.org/jython/jython/pull-request/34/fixes-for-issue-2011-converts-binascii-to/diff should fix this issue.
msg8376 (view) Author: Jim Baker (zyasoft) Date: 2014-05-10.15:38:25
Merged https://bitbucket.org/jython/jython/pull-request/34/fixes-for-issue-2011-converts-binascii-to/diff as of 7239:d3bad92dfc5b
History
Date User Action Args
2014-05-10 15:38:25zyasoftsetstatus: open -> closed
resolution: fixed
messages: + msg8376
2014-05-10 06:01:24indrasetnosy: + indra
messages: + msg8368
2014-05-04 20:12:02zyasoftsetnosy: + zyasoft
messages: + msg8327
2013-11-01 23:59:11santa4ntsetnosy: + santa4nt
2013-09-29 21:44:36jeff.allensetnosy: + jeff.allen
messages: + msg8136
2013-02-26 23:23:52amaksetnosy: + amak
2013-02-18 23:43:42fwierzbickisetnosy: + fwierzbicki
2013-02-18 23:43:27fwierzbickisetversions: + Jython 2.7, - 2.7a2
2013-02-15 08:47:55mkzsetnosy: + mkz
2013-01-20 14:33:50irmencreate