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
0c992f02
Commit
0c992f02
authored
Apr 06, 2004
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify previous checkin (bitfields for WHY codes).
Restores the self-documenting enum declaration.
parent
d99f7b8f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
Python/ceval.c
Python/ceval.c
+14
-12
No files found.
Python/ceval.c
View file @
0c992f02
...
...
@@ -537,15 +537,17 @@ _Py_CheckRecursiveCall(char *where)
}
/* Status code for main loop (reason for stack unwind) */
#define WHY_NOT 0x0001
#define WHY_EXCEPTION 0x0002
#define WHY_RERAISE 0x0004
#define WHY_RETURN 0x0008
#define WHY_BREAK 0x0010
#define WHY_CONTINUE 0x0020
#define WHY_YIELD 0x0040
static
int
do_raise
(
PyObject
*
,
PyObject
*
,
PyObject
*
);
enum
why_code
{
WHY_NOT
=
0x0001
,
/* No error */
WHY_EXCEPTION
=
0x0002
,
/* Exception occurred */
WHY_RERAISE
=
0x0004
,
/* Exception re-raised by 'finally' */
WHY_RETURN
=
0x0008
,
/* 'return' statement */
WHY_BREAK
=
0x0010
,
/* 'break' statement */
WHY_CONTINUE
=
0x0020
,
/* 'continue' statement */
WHY_YIELD
=
0x0040
/* 'yield' operator */
};
static
enum
why_code
do_raise
(
PyObject
*
,
PyObject
*
,
PyObject
*
);
static
int
unpack_iterable
(
PyObject
*
,
int
,
PyObject
**
);
/* for manipulating the thread switch and periodic "stuff" - used to be
...
...
@@ -578,7 +580,7 @@ eval_frame(PyFrameObject *f)
register
unsigned
char
*
next_instr
;
register
int
opcode
=
0
;
/* Current opcode */
register
int
oparg
=
0
;
/* Current opcode argument, if any */
register
int
why
;
/* Reason for block stack unwind */
register
enum
why_code
why
;
/* Reason for block stack unwind */
register
int
err
;
/* Error status -- nonzero if error */
register
PyObject
*
x
;
/* Result object -- NULL if error */
register
PyObject
*
v
;
/* Temporary objects popped off stack */
...
...
@@ -1650,7 +1652,7 @@ eval_frame(PyFrameObject *f)
case
END_FINALLY
:
v
=
POP
();
if
(
PyInt_Check
(
v
))
{
why
=
(
int
)
PyInt_AS_LONG
(
v
);
why
=
(
enum
why_code
)
PyInt_AS_LONG
(
v
);
assert
(
why
!=
WHY_YIELD
);
if
(
why
&
(
WHY_RETURN
|
WHY_CONTINUE
))
retval
=
POP
();
...
...
@@ -2834,7 +2836,7 @@ reset_exc_info(PyThreadState *tstate)
/* Logic for the raise statement (too complicated for inlining).
This *consumes* a reference count to each of its arguments. */
static
int
static
enum
why_code
do_raise
(
PyObject
*
type
,
PyObject
*
value
,
PyObject
*
tb
)
{
if
(
type
==
NULL
)
{
...
...
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