classification
Title: binhex buggy in py3k
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.1, Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, pitrou
Priority: normal Keywords: patch

Created on 2009-06-29 14:36 by pitrou, last changed 2009-07-01 15:04 by pitrou. This issue is now closed.

Files
File name Uploaded Description Edit
binhex.patch pitrou, 2009-06-29 14:50
Messages (5)
msg89842 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-06-29 14:36
The binhex module is buggy in py3k, witness the following example (it
works ok on trunk):

>>> binhex.binhex("README", "testA")
>>> binhex.hexbin("testA", "outA")
>>> binhex.binhex("LICENSE", "testB")
>>> binhex.hexbin("testB", "outB")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/antoine/py3k/__svn__/Lib/binhex.py", line 445, in hexbin
    ifp = HexBin(inp)
  File "/home/antoine/py3k/__svn__/Lib/binhex.py", line 364, in __init__
    self._readheader()
  File "/home/antoine/py3k/__svn__/Lib/binhex.py", line 384, in _readheader
    rest = self._read(1 + 4 + 4 + 2 + 4 + 4)
  File "/home/antoine/py3k/__svn__/Lib/binhex.py", line 367, in _read
    data = self.ifp.read(len)
  File "/home/antoine/py3k/__svn__/Lib/binhex.py", line 300, in read
    self._fill(wtd - len(self.post_buffer))
  File "/home/antoine/py3k/__svn__/Lib/binhex.py", line 337, in _fill
    binascii.rledecode_hqx(self.pre_buffer[:mark])
binascii.Error: Orphaned RLE code at start
msg89845 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-06-29 14:50
The bug is due to bytes-indexing returning an int in py3k while it
returns another bytes object in trunk. Here is a patch. I don't know how
to reliably test for it, though.
msg89891 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-06-29 22:48
Believe it or not, the failing test is already in svn:
http://mail.python.org/pipermail/python-checkins/2009-June/084616.html
msg89921 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-06-30 12:59
Well, failure or success of the current tests seems to rely on the
length of the filename being tested! :-)
msg89980 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-07-01 15:04
Fixed in r73747 and r73748.
History
Date User Action Args
2009-07-01 15:04:19pitrousetstatus: open -> closed
resolution: fixed
messages: + msg89980
2009-06-30 12:59:22pitrousetmessages: + msg89921
2009-06-29 22:48:11amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg89891
2009-06-29 14:50:23pitrousetfiles: + binhex.patch
keywords: + patch
messages: + msg89845

stage: needs patch -> patch review
2009-06-29 14:36:17pitroucreate