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):
...          return self.value
... 
>>> struct.pack('P', IDX(9))
b'\t\x00\x00\x00\x00\x00\x00\x00'
>>>

----------

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

Reply via email to