Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
80b03ffb
Commit
80b03ffb
authored
Jan 01, 2002
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #494783: Rename cmp_op enumerators.
parent
58585eae
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
32 deletions
+39
-32
Include/opcode.h
Include/opcode.h
+3
-3
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+2
-0
Python/ceval.c
Python/ceval.c
+19
-15
Python/compile.c
Python/compile.c
+14
-14
No files found.
Include/opcode.h
View file @
80b03ffb
...
...
@@ -142,9 +142,9 @@ extern "C" {
/* Support for opargs more than 16 bits long */
#define EXTENDED_ARG 143
/* Comparison operator codes (argument to COMPARE_OP) */
enum
cmp_op
{
LT
=
Py_LT
,
LE
=
Py_LE
,
EQ
=
Py_EQ
,
NE
=
Py_NE
,
GT
=
Py_GT
,
GE
=
Py_GE
,
IN
,
NOT_IN
,
IS
,
IS_NOT
,
EXC_MATCH
,
BAD
};
enum
cmp_op
{
PyCmp_LT
=
Py_LT
,
PyCmp_LE
=
Py_LE
,
PyCmp_EQ
=
Py_EQ
,
PyCmp_NE
=
Py_NE
,
PyCmp_GT
=
Py_GT
,
PyCmp_
GE
=
Py_GE
,
PyCmp_IN
,
PyCmp_NOT_IN
,
PyCmp_IS
,
PyCmp_IS_NOT
,
PyCmp_EXC_MATCH
,
PyCmp_
BAD
};
#define HAS_ARG(op) ((op) >= HAVE_ARGUMENT)
...
...
Misc/ACKS
View file @
80b03ffb
...
...
@@ -85,6 +85,7 @@ Tom Christiansen
Vadim Chugunov
David Cinege
Mike Clarkson
Brad Clements
Steve Clift
Josh Cogliati
Dave Cole
...
...
Misc/NEWS
View file @
80b03ffb
...
...
@@ -24,6 +24,8 @@ Build
C API
- The enumerators of cmp_op have been renamed to use the prefix PyCmp_.
- An old #define of ANY as void has been removed from pyport.h. This
hasn't been used since Python's pre-ANSI days, and the #define has
been marked as obsolete since then. SF bug 495548 says it created
...
...
Python/ceval.c
View file @
80b03ffb
...
...
@@ -1785,14 +1785,14 @@ eval_frame(PyFrameObject *f)
a
=
PyInt_AS_LONG
(
v
);
b
=
PyInt_AS_LONG
(
w
);
switch
(
oparg
)
{
case
LT
:
res
=
a
<
b
;
break
;
case
LE
:
res
=
a
<=
b
;
break
;
case
EQ
:
res
=
a
==
b
;
break
;
case
NE
:
res
=
a
!=
b
;
break
;
case
GT
:
res
=
a
>
b
;
break
;
case
GE
:
res
=
a
>=
b
;
break
;
case
IS
:
res
=
v
==
w
;
break
;
case
IS_NOT
:
res
=
v
!=
w
;
break
;
case
PyCmp_
LT
:
res
=
a
<
b
;
break
;
case
PyCmp_
LE
:
res
=
a
<=
b
;
break
;
case
PyCmp_
EQ
:
res
=
a
==
b
;
break
;
case
PyCmp_
NE
:
res
=
a
!=
b
;
break
;
case
PyCmp_
GT
:
res
=
a
>
b
;
break
;
case
PyCmp_
GE
:
res
=
a
>=
b
;
break
;
case
PyCmp_
IS
:
res
=
v
==
w
;
break
;
case
PyCmp_
IS_NOT
:
res
=
v
!=
w
;
break
;
default:
goto
slow_compare
;
}
x
=
res
?
Py_True
:
Py_False
;
...
...
@@ -2986,6 +2986,10 @@ PyEval_MergeCompilerFlags(PyCompilerFlags *cf)
result
=
1
;
cf
->
cf_flags
|=
compilerflags
;
}
if
(
codeflags
&
CO_GENERATOR_ALLOWED
)
{
result
=
1
;
cf
->
cf_flags
|=
CO_GENERATOR_ALLOWED
;
}
}
return
result
;
}
...
...
@@ -3470,21 +3474,21 @@ cmp_outcome(int op, register PyObject *v, register PyObject *w)
{
int
res
=
0
;
switch
(
op
)
{
case
IS
:
case
IS_NOT
:
case
PyCmp_
IS
:
case
PyCmp_
IS_NOT
:
res
=
(
v
==
w
);
if
(
op
==
(
int
)
IS_NOT
)
if
(
op
==
(
int
)
PyCmp_
IS_NOT
)
res
=
!
res
;
break
;
case
IN
:
case
NOT_IN
:
case
PyCmp_
IN
:
case
PyCmp_
NOT_IN
:
res
=
PySequence_Contains
(
w
,
v
);
if
(
res
<
0
)
return
NULL
;
if
(
op
==
(
int
)
NOT_IN
)
if
(
op
==
(
int
)
PyCmp_
NOT_IN
)
res
=
!
res
;
break
;
case
EXC_MATCH
:
case
PyCmp_
EXC_MATCH
:
res
=
PyErr_GivenExceptionMatches
(
v
,
w
);
break
;
default:
...
...
Python/compile.c
View file @
80b03ffb
...
...
@@ -702,7 +702,7 @@ com_addbyte(struct compiling *c, int byte)
{
/*fprintf(stderr, "%3d: %3d\n", c->c_nexti, byte);*/
assert
(
byte
>=
0
&&
byte
<=
255
);
assert
(
c
->
c_code
);
assert
(
c
->
c_code
!=
0
);
if
(
com_check_size
(
&
c
->
c_code
,
c
->
c_nexti
))
{
c
->
c_errors
++
;
return
;
...
...
@@ -2138,26 +2138,26 @@ cmp_type(node *n)
if
(
NCH
(
n
)
==
1
)
{
n
=
CHILD
(
n
,
0
);
switch
(
TYPE
(
n
))
{
case
LESS
:
return
LT
;
case
GREATER
:
return
GT
;
case
LESS
:
return
PyCmp_
LT
;
case
GREATER
:
return
PyCmp_
GT
;
case
EQEQUAL
:
/* == */
case
EQUAL
:
return
EQ
;
case
LESSEQUAL
:
return
LE
;
case
GREATEREQUAL
:
return
GE
;
case
NOTEQUAL
:
return
NE
;
/* <> or != */
case
NAME
:
if
(
strcmp
(
STR
(
n
),
"in"
)
==
0
)
return
IN
;
if
(
strcmp
(
STR
(
n
),
"is"
)
==
0
)
return
IS
;
case
EQUAL
:
return
PyCmp_
EQ
;
case
LESSEQUAL
:
return
PyCmp_
LE
;
case
GREATEREQUAL
:
return
PyCmp_
GE
;
case
NOTEQUAL
:
return
PyCmp_
NE
;
/* <> or != */
case
NAME
:
if
(
strcmp
(
STR
(
n
),
"in"
)
==
0
)
return
PyCmp_
IN
;
if
(
strcmp
(
STR
(
n
),
"is"
)
==
0
)
return
PyCmp_
IS
;
}
}
else
if
(
NCH
(
n
)
==
2
)
{
switch
(
TYPE
(
CHILD
(
n
,
0
)))
{
case
NAME
:
if
(
strcmp
(
STR
(
CHILD
(
n
,
1
)),
"in"
)
==
0
)
return
NOT_IN
;
return
PyCmp_
NOT_IN
;
if
(
strcmp
(
STR
(
CHILD
(
n
,
0
)),
"is"
)
==
0
)
return
IS_NOT
;
return
PyCmp_
IS_NOT
;
}
}
return
BAD
;
return
PyCmp_
BAD
;
}
static
void
...
...
@@ -2214,7 +2214,7 @@ com_comparison(struct compiling *c, node *n)
com_addbyte
(
c
,
ROT_THREE
);
}
op
=
cmp_type
(
CHILD
(
n
,
i
-
1
));
if
(
op
==
BAD
)
{
if
(
op
==
PyCmp_
BAD
)
{
com_error
(
c
,
PyExc_SystemError
,
"com_comparison: unknown comparison op"
);
}
...
...
@@ -3247,7 +3247,7 @@ com_try_except(struct compiling *c, node *n)
com_addbyte
(
c
,
DUP_TOP
);
com_push
(
c
,
1
);
com_node
(
c
,
CHILD
(
ch
,
1
));
com_addoparg
(
c
,
COMPARE_OP
,
EXC_MATCH
);
com_addoparg
(
c
,
COMPARE_OP
,
PyCmp_
EXC_MATCH
);
com_pop
(
c
,
1
);
com_addfwref
(
c
,
JUMP_IF_FALSE
,
&
except_anchor
);
com_addbyte
(
c
,
POP_TOP
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment