A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/python/cpython/commit/34a042d301d6ab88645046a6dfa6c38265ca4b39 below:

This is the last time I fix binhex. If it breaks again it goes in th… · python/cpython@34a042d · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+8

-10

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+8

-10

lines changed Original file line number Diff line number Diff line change

@@ -53,7 +53,7 @@ def getfileinfo(name):

53 53

finfo = FSSpec(name).FSpGetFInfo()

54 54

dir, file = os.path.split(name)

55 55

# XXX Get resource/data sizes

56 -

fp = open(name, 'rb')

56 +

fp = io.open(name, 'rb')

57 57

fp.seek(0, 2)

58 58

dlen = fp.tell()

59 59

fp = openrf(name, '*rb')

@@ -172,11 +172,11 @@ def __init__(self, name_finfo_dlen_rlen, ofp):

172 172

name, finfo, dlen, rlen = name_finfo_dlen_rlen

173 173

if isinstance(ofp, basestring):

174 174

ofname = ofp

175 -

ofp = open(ofname, 'w')

175 +

ofp = io.open(ofname, 'wb')

176 176

if os.name == 'mac':

177 177

fss = FSSpec(ofname)

178 178

fss.SetCreatorType('BnHq', 'TEXT')

179 -

ofp.write('(This file must be converted with BinHex 4.0)\n\n:')

179 +

ofp.write(b'(This file must be converted with BinHex 4.0)\r\r:')

180 180

hqxer = _Hqxcoderengine(ofp)

181 181

self.ofp = _Rlecoderengine(hqxer)

182 182

self.crc = 0

@@ -253,7 +253,7 @@ def binhex(inp, out):

253 253

finfo = getfileinfo(inp)

254 254

ofp = BinHex(finfo, out)

255 255 256 -

ifp = open(inp, 'rb')

256 +

ifp = io.open(inp, 'rb')

257 257

# XXXX Do textfile translation on non-mac systems

258 258

while 1:

259 259

d = ifp.read(128000)

@@ -371,7 +371,7 @@ def close(self):

371 371

class HexBin:

372 372

def __init__(self, ifp):

373 373

if isinstance(ifp, basestring):

374 -

ifp = open(ifp)

374 +

ifp = io.open(ifp, 'rb')

375 375

#

376 376

# Find initial colon.

377 377

#

@@ -381,12 +381,10 @@ def __init__(self, ifp):

381 381

raise Error, "No binhex data found"

382 382

# Cater for \r\n terminated lines (which show up as \n\r, hence

383 383

# all lines start with \r)

384 -

if ch == '\r':

384 +

if ch == b'\r':

385 385

continue

386 -

if ch == ':':

386 +

if ch == b':':

387 387

break

388 -

if ch != '\n':

389 -

dummy = ifp.readline()

390 388 391 389

hqxifp = _Hqxdecoderengine(ifp)

392 390

self.ifp = _Rledecoderengine(hqxifp)

@@ -480,7 +478,7 @@ def hexbin(inp, out):

480 478

ofss = FSSpec(out)

481 479

out = ofss.as_pathname()

482 480 483 -

ofp = open(out, 'wb')

481 +

ofp = io.open(out, 'wb')

484 482

# XXXX Do translation on non-mac systems

485 483

while 1:

486 484

d = ifp.read(128000)

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4