merge stable for PR#141, #982

This commit is contained in:
Takayuki Shimizukawa
2013-06-04 09:19:49 +00:00
2 changed files with 4 additions and 1 deletions

View File

@@ -22,6 +22,8 @@ Bugs fixed
* Fix: 'make gettext' cause UnicodeDecodeError when templates contain utf-8
encoded string.
* #1162, PR#139: singlehtml builder doesn't copy images to _images/.
* PR#141, #982: Avoid crash when writing PNG file using Python 3. Thansk to
Marcin Wojdyr.
Release 1.2 (beta1 released Mar 31, 2013)

View File

@@ -51,7 +51,8 @@ def write_png_depth(filename, depth):
# overwrite it with the depth chunk
f.write(DEPTH_CHUNK_LEN + DEPTH_CHUNK_START + data)
# calculate the checksum over chunk name and data
f.write(struct.pack('!i', binascii.crc32(DEPTH_CHUNK_START + data)))
crc = binascii.crc32(DEPTH_CHUNK_START + data) & 0xffffffff
f.write(struct.pack('!I', crc))
# replace the IEND chunk
f.write(IEND_CHUNK)
finally: