mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Remove PyInt_CheckExact. Add PyLong_AsLongAndOverflow.
This commit is contained in:
parent
0fbab7ff8d
commit
d1a1d1ed80
15 changed files with 134 additions and 54 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue