
On Wed, Mar 30, 2011 at 5:32 PM, Eli Stevens (Gmail) <wickedgrey@gmail.com> wrote:
On Wed, Mar 30, 2011 at 5:06 PM, Raymond Hettinger <raymond.hettinger@gmail.com> wrote:
I think the struct module addition for float16 could be handled separately and much more easily (since a half would fit in a double, but a long long double won't).
Okay, if no other objections get raised, I'll open a new issue for it (probably sometime tomorrow).
The issue is here: http://bugs.python.org/issue11734
Yes, I will try and compile/test CPython and build a patch for _struct.c from the current repo.
I am a little unclear as to the purpose of structmember.{h,c}; does the .h file need a line for the half-float type along the lines of: #define T_HALFFLOAT 21 And do PyMember_GetOne and PyMember_SetOne need corresponding entries in their switch statements? Something like: case T_HALFFLOAT: // FIXME: need half support break; case T_FLOAT: v = PyFloat_FromDouble((double)*(float*)addr); break; And: case T_HALFFLOAT:{ // FIXME: needs half support break; } case T_FLOAT:{ double double_val = PyFloat_AsDouble(v); if ((double_val == -1) && PyErr_Occurred()) return -1; *(float*)addr = (float)double_val; break; } The unit tests I've added for the struct.pack and struck.unpack functions don't seem to need it, but I want to make sure there isn't something I'm missing. Apologies if this should be moved to python-dev; just let me know and I can repost there. Thanks! Eli