[issue8300] Allow struct.pack to handle objects with an __index__ method.

Meador Inge report at bugs.python.org
Sun Apr 4 02:38:07 CEST 2010


Meador Inge <meadori at gmail.com> added the comment:

I may be missing something subtle, but how can 'PyNumber_Index(v) != NULL' *and* '!PyInt_Check(v) && !PyLong_Check(v)' both be satisfied in the 'get_pylong' mods?  It seems to me that 'PyNumber_Index' only returns non-NULL when the object being returned is an 'int' or 'long'.  

Attached a patch with the extra check removed and a few more test cases.

----------
Added file: http://bugs.python.org/file16751/struct_index_trunk3.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8300>
_______________________________________


More information about the Python-bugs-list mailing list