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 <>
.apk is primarily used for Android Package files
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:
            tp, ln = unpack('<HH', extra[:4])
            if tp == 1: 
                pass  # substitute for actual code not called
            extra = extra[ln+4:]

The output is
51966 0
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?
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: <>
2012-03-16 21:53:49terry.reedylinkissue14315 messages
2012-03-16 21:53:49terry.reedycreate