[issue12974] array module: deprecate '__int__' conversion support for array elements

2019-03-14 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> duplicate stage: needs patch -> resolved status: open -> closed superseder: -> Deprecate implicit truncating when convert Python numbers to C integers: use __index__, not __int__ ___ Python tracker <

[issue12974] array module: deprecate '__int__' conversion support for array elements

2019-02-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See more general issue36048. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue12974] array module: deprecate '__int__' conversion support for array elements

2016-10-09 Thread Oren Milman
Changes by Oren Milman : -- nosy: +Oren Milman ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue12974] array module: deprecate '__int__' conversion support for array elements

2016-09-28 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:

[issue12974] array module: deprecate '__int__' conversion support for array elements

2014-10-14 Thread Stefan Krah
Changes by Stefan Krah : -- nosy: -skrah ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.o

[issue12974] array module: deprecate '__int__' conversion support for array elements

2011-09-16 Thread Stefan Krah
Stefan Krah added the comment: Meador Inge wrote: > The behavior around '__int__' in previous versions seems somewhat accidental. I think struct followed the functions in longobject.c, which is not really consistent with respect to duck typing. See also #12965 or http://bugs.python.org/issue11

[issue12974] array module: deprecate '__int__' conversion support for array elements

2011-09-16 Thread Meador Inge
Meador Inge added the comment: > I specifically meant the 'P' format. As far as I can see, PyLong_AsVoidPtr() > never allowed __int__(), but now index objects can be packed as pointers. > It isn't a big deal, I just have to know for features/pep-3118. > > To illustrate, this is python2.5.0; INT

[issue12974] array module: deprecate '__int__' conversion support for array elements

2011-09-16 Thread Stefan Krah
Stefan Krah added the comment: Mark Dickinson wrote: > Yes, that's intentional. When use of __int__ was deprecated, a bug > report popped up from someone who wanted to be able to have their own > objects treated as integers for the purposes of struct.pack. > (I don't recall which issue; Mead

[issue12974] array module: deprecate '__int__' conversion support for array elements

2011-09-16 Thread Mark Dickinson
Mark Dickinson added the comment: Yes, that's intentional. When use of __int__ was deprecated, a bug report popped up from someone who wanted to be able to have their own objects treated as integers for the purposes of struct.pack. (I don't recall which issue; Meador, do you remember?) So

[issue12974] array module: deprecate '__int__' conversion support for array elements

2011-09-16 Thread Stefan Krah
Stefan Krah added the comment: I just discovered that struct packs pointers from objects with an __index__() method. Is that intentional? >>> import struct >>> class IDX(object): ... def __init__(self, value): ... self.value = value ... def __index__(self): ... return s

[issue12974] array module: deprecate '__int__' conversion support for array elements

2011-09-13 Thread Meador Inge
New submission from Meador Inge : When reviewing the fix for issue1172711 it was discovered that the 'array' module allows for '__int__' conversions: >>> import array, struct >>> a = array.array('L', [1,2,3]) >>> class T(object): ... def __init__(self, value): ... self.value = value