Message100576
Here's a patch to restore the old usage of __int__ to convert non-integer arguments; it also produces a DeprecationWarning whenever __int__ is used in this way. For consistency and simplicity, __int__ will be tried for *any* non-integer argument when packing with an integer format; this goes beyond the conversions that 2.6 allows. (In 2.6, the behaviour is somewhat random: it works only for 'bBhHil' in native mode and 'bhil' in non-native mode.)
It doesn't seem worth deliberately trying __long__ as well, so I've left that out. So there's still some possibility for breakage relative to 2.6, when (1) packing using 'Q' or 'q', *and* (2) the object to be packed defines __long__ but not __int__, or defines both __long__ and __int__ in inconsistent ways. The likelihood of (2) seems small enough that this isn't worth worrying about in practice (and the workaround is easy, too).
Andreas, are you in a position to test this patch?
Supporting conversions to integer via __index__ is orthogonal to this; I'll take a look at Meador's patch shortly. |
|
Date |
User |
Action |
Args |
2010-03-07 12:22:57 | mark.dickinson | set | recipients:
+ mark.dickinson, nnorwitz, georg.brandl, collinwinter, jafo, bob.ippolito, piman, inducer, giampaolo.rodola, benjamin.peterson, meador.inge |
2010-03-07 12:22:56 | mark.dickinson | set | messageid: <1267964576.65.0.754954897344.issue1530559@psf.upfronthosting.co.za> |
2010-03-07 12:22:54 | mark.dickinson | link | issue1530559 messages |
2010-03-07 12:22:53 | mark.dickinson | create | |
|