[Patches] [ python-Patches-1024670 ] Error when int sent to
PyLong_AsUnsignedLong
SourceForge.net
noreply at sourceforge.net
Mon Sep 20 00:41:46 CEST 2004
Patches item #1024670, was opened at 2004-09-08 14:03
Message generated for change (Comment added) made by crnixon
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1024670&group_id=5470
Category: Core (C code)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Clinton R. Nixon (crnixon)
Assigned to: Nobody/Anonymous (nobody)
Summary: Error when int sent to PyLong_AsUnsignedLong
Initial Comment:
When sending a Python integer as an argument to
PyLong_AsUnsignedLong, the following error occurs
SystemError: Objects/longobject.c:240: bad argument to
internal function
This error comes from the fact that
PyLong_AsUnsignedLong, unlike PyLong_AsLong, does not
check to see if the number is a long or integer, but
only a long.
This patch checks to see if the number is an integer,
and if so, calls PyInt_AsUnsignedLongMask.
----------------------------------------------------------------------
>Comment By: Clinton R. Nixon (crnixon)
Date: 2004-09-19 15:41
Message:
Logged In: YES
user_id=350049
The reasons I submitted the patch:
* There's a precedent in the PyLong_AsLong code.
* The error was causing PyCDK (Python binding to the Curses
Development Kit) to segfault.
* Seeing as there's no data lost converting from int to
long, it makes sense to go ahead and convert instead of
crapping out.
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2004-09-18 09:11
Message:
Logged In: YES
user_id=21627
Why is it desirable to accept ints in PyLong_AsUnsignedLong?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1024670&group_id=5470
More information about the Patches
mailing list