Mark Dickinson <dicki...@gmail.com> added the comment: 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. ---------- Added file: http://bugs.python.org/file16748/struct_index_trunk2.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8300> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com