Remove PyInt_CheckExact. Add PyLong_AsLongAndOverflow.

This commit is contained in:
Martin v. Löwis 2007-12-04 22:10:37 +00:00
parent 0fbab7ff8d
commit d1a1d1ed80
15 changed files with 134 additions and 54 deletions

View file

@ -196,8 +196,13 @@ PyCursesCheckERR(int code, char *fname)
static int
PyCurses_ConvertToChtype(PyObject *obj, chtype *ch)
{
if (PyInt_CheckExact(obj)) {
*ch = (chtype) PyLong_AsLong(obj);
if (PyLong_CheckExact(obj)) {
int overflow;
/* XXX should the truncation by the cast also be reported
as an error? */
*ch = (chtype) PyLong_AsLongAndOverflow(obj, &overflow);
if (overflow)
return 0;
} else if(PyString_Check(obj)
&& (PyString_Size(obj) == 1)) {
*ch = (chtype) *PyString_AsString(obj);