[Python-checkins] CVS: python/dist/src/Python ceval.c,2.271,2.272
Guido van Rossum
gvanrossum@users.sourceforge.net
Thu, 30 Aug 2001 09:06:25 -0700
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv26112
Modified Files:
ceval.c
Log Message:
Do the int inlining only if the type is really an int, not whenever
PyInt_Check() succeeds. That returns true for subtypes of int, which
may override __add__ or __sub__.
Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.271
retrieving revision 2.272
diff -C2 -d -r2.271 -r2.272
*** ceval.c 2001/08/30 14:05:20 2.271
--- ceval.c 2001/08/30 16:06:23 2.272
***************
*** 549,552 ****
--- 549,555 ----
#endif
+ /* Strict int check macros */
+ #define ISSTRICTINT(v) ((v)->ob_type == &PyInt_Type)
+
/* Local variable macros */
***************
*** 910,914 ****
w = POP();
v = POP();
! if (PyInt_Check(v) && PyInt_Check(w)) {
/* INLINE: int + int */
register long a, b, i;
--- 913,917 ----
w = POP();
v = POP();
! if (ISSTRICTINT(v) && ISSTRICTINT(w)) {
/* INLINE: int + int */
register long a, b, i;
***************
*** 933,937 ****
w = POP();
v = POP();
! if (PyInt_Check(v) && PyInt_Check(w)) {
/* INLINE: int - int */
register long a, b, i;
--- 936,940 ----
w = POP();
v = POP();
! if (ISSTRICTINT(v) && ISSTRICTINT(w)) {
/* INLINE: int - int */
register long a, b, i;
***************
*** 956,960 ****
w = POP();
v = POP();
! if (v->ob_type == &PyList_Type && PyInt_Check(w)) {
/* INLINE: list[int] */
long i = PyInt_AsLong(w);
--- 959,963 ----
w = POP();
v = POP();
! if (v->ob_type == &PyList_Type && ISSTRICTINT(w)) {
/* INLINE: list[int] */
long i = PyInt_AsLong(w);
***************
*** 1093,1097 ****
w = POP();
v = POP();
! if (PyInt_Check(v) && PyInt_Check(w)) {
/* INLINE: int + int */
register long a, b, i;
--- 1096,1100 ----
w = POP();
v = POP();
! if (ISSTRICTINT(v) && ISSTRICTINT(w)) {
/* INLINE: int + int */
register long a, b, i;
***************
*** 1116,1120 ****
w = POP();
v = POP();
! if (PyInt_Check(v) && PyInt_Check(w)) {
/* INLINE: int - int */
register long a, b, i;
--- 1119,1123 ----
w = POP();
v = POP();
! if (ISSTRICTINT(v) && ISSTRICTINT(w)) {
/* INLINE: int - int */
register long a, b, i;
***************
*** 1719,1723 ****
w = POP();
v = POP();
! if (PyInt_Check(v) && PyInt_Check(w)) {
/* INLINE: cmp(int, int) */
register long a, b;
--- 1722,1726 ----
w = POP();
v = POP();
! if (ISSTRICTINT(v) && ISSTRICTINT(w)) {
/* INLINE: cmp(int, int) */
register long a, b;