If you look at my commit, I added had actually added a comment to pyg_enum_add stating this (but not pyg_flags_add). Right before this, PyLong_AsUnsignedLong) Things go haywire as soon as gtype is assigned a bit further down: (gdb) call PyLong_AsUnsignedLongMask(item) When this is being called for _MASK (0x40000000, first value to exceed MAX_INT), stepping through gives:Ĥ3 item = (&PYGLIB_PyLong_Type)->tp_new((PyTypeObject*)subclass, args, NULL) The crux of the problem is in pyg_flags_val_new(). So I defined two new aliases PYGLIB_PyLong_FromUnsignedLong() and PYGLIB_PyLong_AsUnsignedLong() (for Python 3 for now, I'll worry about Python 2 once this works at all), and fixed pygflags.c and some other places to use unsigned longs. It happens to work on 64 bit because long just happens to be 64 bit, and we don't have that large flag values. This initially seemed very easy, but it seems I opened a can of worms here.įirst of all, GFlagsValue.value is a guint, so everything that handles flags right now is currently doing it wrong. (on Python 3 only, it is stable on Python 2) Also, I get a different value every time I run it. That first hex value on Python 3 looks very wrong. Notice how it's different from what I get on Python 2: if value.get_name_unescaped() = 'release_mask': > for value in Gdk.ModifierType._info_.get_values(): On the 32 bits machine, Python 3 is having troubles: On the 64 bits machine, everything works fine, both Python 2 and Python 3:
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |