[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

[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

[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 ___

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

2014-10-14 Thread Stefan Krah
Changes by Stefan Krah stefan-use...@bytereef.org: -- nosy: -skrah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12974 ___ ___ Python-bugs-list

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

2011-09-16 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org 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):

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

2011-09-16 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com 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

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

2011-09-16 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org added the comment: Mark Dickinson rep...@bugs.python.org 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

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

2011-09-16 Thread Meador Inge
Meador Inge mead...@gmail.com 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

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

2011-09-16 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org added the comment: Meador Inge rep...@bugs.python.org 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.

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

2011-09-13 Thread Meador Inge
New submission from Meador Inge mead...@gmail.com: 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): ...