wasm-demo/demo/ermis-f/python_m/cur/1189

48 lines
1.4 KiB
Plaintext

From: cgw at fnal.gov (Charles G Waldman)
Date: Tue, 27 Apr 1999 23:13:20 GMT
Subject: Long integers getting short shrift?
In-Reply-To: <37262F45.2473F5A5@callware.com>
References: <14118.9093.292465.438475@buffalo.fnal.gov>
<37262F45.2473F5A5@callware.com>
Message-ID: <14118.17552.252493.22073@buffalo.fnal.gov>
Content-Length: 1061
X-UID: 1189
Ivan Van Laningham writes:
> ???? I have Python running on my UnixWare system at home, and the long
> types are easily accessible.
Perhaps I was unclear, I'm not saying that the long type is not
available; I'm referring to the level of support for Long objects in
the Python/C API, in particular the functions PyArg_ParseTuple and
PyObject_CallFunction. Below is the snippet of code in getargs.c that
handles the "L" format character... I was wishing for something
similar to "L" that would take a plain C int and make a Python Long
out of it... I don't know what letter I'd use since l and L are
already taken!
It's not too important, one can always use the "O" format letter and
handle the arg. specially with PyLong_FromLong; it's just a bit ugly
to have to do so.
#ifdef HAVE_LONG_LONG
case 'L': /* LONG_LONG */
{
LONG_LONG *p = va_arg( *p_va, LONG_LONG * );
LONG_LONG ival = PyLong_AsLongLong( arg );
if( ival == (LONG_LONG)-1 && PyErr_Occurred() ) {
return "long<L>";
} else {
*p = ival;
}
break;
}
#endif