Message 102262 - Python tracker (original) (raw)

That patch was a bit hasty in many respects; here's a better one.

For 2.7, the scheme is as follows: when packing a non-integer with an integer format:

(1) First index is tried (2) If the index method doesn't exist, or the call to index raises TypeError, then the int method is tried. (3) If the index method raises something other than TypeError, or returns a non-integer, then struct.pack fails.