Bugs item #1518190, was opened at 2006-07-06 07:46 Message generated for change (Comment added) made by nnorwitz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1518190&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.5 Status: Open >Resolution: Accepted Priority: 5 Submitted By: Thomas Heller (theller) >Assigned to: Thomas Heller (theller) Summary: c_void_pointer should accept a long pointer > 0x7fffffff Initial Comment: Mike Fletcher reported this problem: http://tinyurl.com/esneq Currently, the c_void_p constructor calls PyLong_AsVoidPtr(value), in Modules/_ctypes/cfield.c, near line 1491. This call should be changed to use either PyLong_AsUnsignedLongMask() or PyLong_AsUnsignedLongLongMask() depending on sizeof(void *), and cast the result to (void *). This change would also make the c_void_p behaviour more consistent with the other c_int, c_long and so on constructors since all of them mask the value to the number of bits they can accept. ---------------------------------------------------------------------- >Comment By: Neal Norwitz (nnorwitz) Date: 2006-07-09 17:32 Message: Logged In: YES user_id=33168 This patch is fine. Please try to apply before the freeze for b2. Also, please use #elif instead of nested #if. It makes the code a little shorter and easier to read. This looks like a bug fix which is fine, though I'm not sure of all the consequences of the change. Be sure to add a note to Misc/NEWS. ---------------------------------------------------------------------- Comment By: Thomas Heller (theller) Date: 2006-07-06 10:03 Message: Logged In: YES user_id=11105 Assigning to Neal for review (please). The #if block is not really needed imo, but I used it for clarity - it is copied verbatim from Objects/longobject.c, which would throw compile errors if the conditions are not fulfilled. ---------------------------------------------------------------------- Comment By: Thomas Heller (theller) Date: 2006-07-06 09:56 Message: Logged In: YES user_id=11105 Attached a patch, with tests, that fixes this bug. PyInt_AsUnsignedLongMask() and PyInt_AsUnsignedLongLongMask() is what we need to use. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1518190&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com