Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c1e6d96

Browse files
committed
Get rid of unique local ISSTRICTINT macro in favor of std PyInt_CheckExact.
1 parent 9835206 commit c1e6d96

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

Python/ceval.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -549,9 +549,6 @@ eval_frame(PyFrameObject *f)
549549
#define POP() BASIC_POP()
550550
#endif
551551

552-
/* Strict int check macros */
553-
#define ISSTRICTINT(v) ((v)->ob_type == &PyInt_Type)
554-
555552
/* Local variable macros */
556553

557554
#define GETLOCAL(i) (fastlocals[i])
@@ -946,7 +943,7 @@ eval_frame(PyFrameObject *f)
946943
case BINARY_ADD:
947944
w = POP();
948945
v = POP();
949-
if (ISSTRICTINT(v) && ISSTRICTINT(w)) {
946+
if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) {
950947
/* INLINE: int + int */
951948
register long a, b, i;
952949
a = PyInt_AS_LONG(v);
@@ -969,7 +966,7 @@ eval_frame(PyFrameObject *f)
969966
case BINARY_SUBTRACT:
970967
w = POP();
971968
v = POP();
972-
if (ISSTRICTINT(v) && ISSTRICTINT(w)) {
969+
if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) {
973970
/* INLINE: int - int */
974971
register long a, b, i;
975972
a = PyInt_AS_LONG(v);
@@ -992,7 +989,7 @@ eval_frame(PyFrameObject *f)
992989
case BINARY_SUBSCR:
993990
w = POP();
994991
v = POP();
995-
if (v->ob_type == &PyList_Type && ISSTRICTINT(w)) {
992+
if (v->ob_type == &PyList_Type && PyInt_CheckExact(w)) {
996993
/* INLINE: list[int] */
997994
long i = PyInt_AsLong(w);
998995
if (i < 0)
@@ -1129,7 +1126,7 @@ eval_frame(PyFrameObject *f)
11291126
case INPLACE_ADD:
11301127
w = POP();
11311128
v = POP();
1132-
if (ISSTRICTINT(v) && ISSTRICTINT(w)) {
1129+
if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) {
11331130
/* INLINE: int + int */
11341131
register long a, b, i;
11351132
a = PyInt_AS_LONG(v);
@@ -1152,7 +1149,7 @@ eval_frame(PyFrameObject *f)
11521149
case INPLACE_SUBTRACT:
11531150
w = POP();
11541151
v = POP();
1155-
if (ISSTRICTINT(v) && ISSTRICTINT(w)) {
1152+
if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) {
11561153
/* INLINE: int - int */
11571154
register long a, b, i;
11581155
a = PyInt_AS_LONG(v);
@@ -1759,7 +1756,7 @@ eval_frame(PyFrameObject *f)
17591756
case COMPARE_OP:
17601757
w = POP();
17611758
v = POP();
1762-
if (ISSTRICTINT(v) && ISSTRICTINT(w)) {
1759+
if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) {
17631760
/* INLINE: cmp(int, int) */
17641761
register long a, b;
17651762
register int res;

0 commit comments

Comments
 (0)