unsigned short in Python 2.0
Michel Sanner
sanner at scripps.edu
Mon Apr 2 18:38:59 EDT 2001
Hi,
I tried my PuOpenGL graphics tools out under Python2.0 and found some
differences with Python 1.5.2
it seems that with Python 1.5.2 it was possible to pass an unsigned short value
to a function expecting a short. This is used in _openglmodule.c, for instance
static PyObject* gl_LineStipple(PyObject* self, PyObject* args)
{
GLint arg1;
GLushort arg2;
TRY (PyArg_ParseTuple(args, "ih", &arg1, &arg2));
glLineStipple(arg1, arg2);
Py_INCREF(Py_None);
return Py_None;
}
Python 1.5.2 (#0, Apr 14 2000, 10:15:38) [C] on irix646
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
IDLE 0.5 -- press F1 for help
>>> from OpenGL import GL
>>> GL.glLineStipple(1.0, 0xFFFF)
No problem
under python2.0 passing anything larger than 2**15-1 creates a overflow
exception (I think in PyArg_ParseTuple).
Python 2.0 (#4, Oct 23 2000, 11:20:17) [C] on irix646
Copyright (c) 2000 BeOpen.com.
All Rights Reserved.
>>> from OpenGL import GL
>>> GL.glLineStipple(1.0, 0xFFFF)
Traceback (innermost last):
File "<pyshell#2>", line 1, in ?
GL.glLineStipple(1.0, 0xFFFF)
OverflowError: signed short integer is greater than maximum
>>>
I could not see how to specify an unsigned short in the documentation :( ..
-Michel
--
-----------------------------------------------------------------------
>>>>>>>>>> AREA CODE CHANGE <<<<<<<<< we are now 858 !!!!!!!
Michel F. Sanner Ph.D. The Scripps Research Institute
Assistant Professor Department of Molecular Biology
10550 North Torrey Pines Road
Tel. (858) 784-2341 La Jolla, CA 92037
Fax. (858) 784-2860
sanner at scripps.edu http://www.scripps.edu/sanner
-----------------------------------------------------------------------
More information about the Python-list
mailing list