homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients alanmcintyre, mark.dickinson, meador.inge, pleed, terry.reedy
Date 2012年03月16日.21:53:49
SpamBayes Score 1.494451e-07
Marked as misclassified No
Message-id <1331934830.19.0.842805081947.issue14315@psf.upfronthosting.co.za>
In-reply-to
Content
.apk is primarily used for Android Package files
https://en.wikipedia.org/wiki/APK_%28file_format%29
which are zipped JAR-based archives. By changing .apk to .zip, I can open the file in Win7 explorer, which has zip built in.
A 'crash' is a segfault or equvalent. A traceback is a graceful shutdown and not a crash. I reproduced the traceback on 3.3.0a1. It appears to say that there are not enough bytes.
import struct
struct.unpack('<HH', b'abc')
#produces the same error
struct.error: unpack requires a bytes object of length 4
The 3.x message is clearer in that the second arg is a bytestring, not a char string. It would not hurt it it said how many bytes it did get.
However, the behavior that leads to the message baffles me. The _decodeExtra code looks like this, with some prints that I added.
 def _decodeExtra(self):
 # Try to decode the extra field.
 extra = self.extra
 unpack = struct.unpack
 while extra:
 print(extra)
 tp, ln = unpack('<HH', extra[:4])
 print(tp,ln)
 if tp == 1: 
 pass # substitute for actual code not called
 extra = extra[ln+4:]
 print(extra)
The output is
b'\xfe\xca\x00\x00'
51966 0
b''
b'\x00'
Traceback (most recent call last): ...
So it looks like extra was properly formatted and properly snipped to 0 bytes, but somehow gained a null byte before being tested again. 1 byte is not 4 bytes and hence the error, but how?
History
Date User Action Args
2012年03月16日 21:53:50terry.reedysetrecipients: + terry.reedy, mark.dickinson, alanmcintyre, meador.inge, pleed
2012年03月16日 21:53:50terry.reedysetmessageid: <1331934830.19.0.842805081947.issue14315@psf.upfronthosting.co.za>
2012年03月16日 21:53:49terry.reedylinkissue14315 messages
2012年03月16日 21:53:49terry.reedycreate

AltStyle によって変換されたページ (->オリジナル) /