Mark Dickinson <dicki...@gmail.com> added the comment:

More or less, yes:  when trying to pack a non-integer `x` (i.e. something 
that's not an instance of int or long) with an integer format code (one of 
'bBhHiIlLqQ', or 'P'), `x.__index__()` would be called to convert `x` to an 
integer, and that integer would be packed as usual (possibly raising 
OverflowError).  Other format codes wouldn't be affected.

I'm not quite sure what you mean by 'beforehand':  the conversion would happen 
at the same time as it currently does.

It might be a struggle for me to get to this before the 2.7 betas.  If anyone's 
interested in submitting a patch, it would be welcome.

----------
stage: committed/rejected -> needs patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue1530559>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to