| Issue 33: | pdfsizeopt gets "DeprecationWarning: 'H' format requires 0 <= number <= 65535" [patch] | |
| 1 person starred this issue and may be notified of changes. | Back to list |
What steps will reproduce the problem? 1. python pdfsizeopt.py concen.pdf I used the test file from issue 19 https://code.google.com/p/pdfsizeopt/issues/detail?id=19 What is the expected output? What do you see instead? I get two deprecation warnings. (The resulting pdf is ok.) $ python pdfsizeopt.py concen.pdf info: This is pdfsizeopt.py rUNKNOWN. info: loading PDF from: concen.pdf info: loaded PDF of 294339 bytes info: separated to 229 objs info: found 0 Type1 fonts loaded info: found 23 Type1C fonts loaded info: writing Type1CParser (67298 font bytes) to: pso.conv.parse.tmp.ps info: executing Type1CParser with Ghostscript: gs -q -dNOPAUSE -dBATCH -sDEVICE=nullpage -sDataFile=pso.conv.parsedata.tmp.ps -f pso.conv.parse.tmp.ps Type1CParser: using interpreter GPL Ghostscript 871 20100210 Type1CParser: all OK info: parsed 23 Type1C fonts pdfsizeopt.py:2214: DeprecationWarning: struct integer overflow masking is deprecated output.append(chr(28) + struct.pack('>H', operand)) pdfsizeopt.py:2214: DeprecationWarning: 'H' format requires 0 <= number <= 65535 output.append(chr(28) + struct.pack('>H', operand)) What version of the product are you using? On what operating system? Fedora 8 Linux --- pdfsizeopt/pdfsizeopt.py- 2010-03-24 21:06:15.000000000 +0000 +++ pdfsizeopt/pdfsizeopt.py 2010-03-30 01:55:38.000000000 +0100 @@ -2211,7 +2211,7 @@ (((-operand - 108) >> 8) + 251, (-operand - 108) & 255)) assert 251 <= ord(output[-1][0]) <= 254 elif -32768 <= operand <= 32767: - output.append(chr(28) + struct.pack('>H', operand)) + output.append(chr(28) + struct.pack('>H', operand & 0xFFFF)) elif ~0x7fffffff <= operand <= 0x7fffffff: output.append(chr(29) + struct.pack('>L', operand)) else:
Feb 10, 2011
Project Member
#1
pts...@gmail.com
Status:
Fixed
|