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
79792651
Commit
79792651
authored
Nov 14, 2005
by
Neal Norwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert all internal errors from Exception to SystemError
Remove an abort() and let a SystemError be raised.
parent
daae6161
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
19 deletions
+17
-19
Python/ast.c
Python/ast.c
+17
-19
No files found.
Python/ast.c
View file @
79792651
...
@@ -448,7 +448,7 @@ ast_for_augassign(const node *n)
...
@@ -448,7 +448,7 @@ ast_for_augassign(const node *n)
else
else
return
Mult
;
return
Mult
;
default:
default:
PyErr_Format
(
PyExc_
Exception
,
"invalid augassign: %s"
,
STR
(
n
));
PyErr_Format
(
PyExc_
SystemError
,
"invalid augassign: %s"
,
STR
(
n
));
return
0
;
return
0
;
}
}
}
}
...
@@ -481,7 +481,7 @@ ast_for_comp_op(const node *n)
...
@@ -481,7 +481,7 @@ ast_for_comp_op(const node *n)
if
(
strcmp
(
STR
(
n
),
"is"
)
==
0
)
if
(
strcmp
(
STR
(
n
),
"is"
)
==
0
)
return
Is
;
return
Is
;
default:
default:
PyErr_Format
(
PyExc_
Exception
,
"invalid comp_op: %s"
,
PyErr_Format
(
PyExc_
SystemError
,
"invalid comp_op: %s"
,
STR
(
n
));
STR
(
n
));
return
0
;
return
0
;
}
}
...
@@ -495,12 +495,12 @@ ast_for_comp_op(const node *n)
...
@@ -495,12 +495,12 @@ ast_for_comp_op(const node *n)
if
(
strcmp
(
STR
(
CHILD
(
n
,
0
)),
"is"
)
==
0
)
if
(
strcmp
(
STR
(
CHILD
(
n
,
0
)),
"is"
)
==
0
)
return
IsNot
;
return
IsNot
;
default:
default:
PyErr_Format
(
PyExc_
Exception
,
"invalid comp_op: %s %s"
,
PyErr_Format
(
PyExc_
SystemError
,
"invalid comp_op: %s %s"
,
STR
(
CHILD
(
n
,
0
)),
STR
(
CHILD
(
n
,
1
)));
STR
(
CHILD
(
n
,
0
)),
STR
(
CHILD
(
n
,
1
)));
return
0
;
return
0
;
}
}
}
}
PyErr_Format
(
PyExc_
Exception
,
"invalid comp_op: has %d children"
,
PyErr_Format
(
PyExc_
SystemError
,
"invalid comp_op: has %d children"
,
NCH
(
n
));
NCH
(
n
));
return
0
;
return
0
;
}
}
...
@@ -669,7 +669,7 @@ ast_for_arguments(struct compiling *c, const node *n)
...
@@ -669,7 +669,7 @@ ast_for_arguments(struct compiling *c, const node *n)
i
+=
3
;
i
+=
3
;
break
;
break
;
default:
default:
PyErr_Format
(
PyExc_
Exception
,
PyErr_Format
(
PyExc_
SystemError
,
"unexpected node in varargslist: %d @ %d"
,
"unexpected node in varargslist: %d @ %d"
,
TYPE
(
ch
),
i
);
TYPE
(
ch
),
i
);
goto
error
;
goto
error
;
...
@@ -1309,8 +1309,7 @@ ast_for_atom(struct compiling *c, const node *n)
...
@@ -1309,8 +1309,7 @@ ast_for_atom(struct compiling *c, const node *n)
return
Repr
(
expression
,
LINENO
(
n
));
return
Repr
(
expression
,
LINENO
(
n
));
}
}
default:
default:
PyErr_Format
(
PyExc_Exception
,
"unhandled atom %d"
,
PyErr_Format
(
PyExc_SystemError
,
"unhandled atom %d"
,
TYPE
(
ch
));
TYPE
(
ch
));
return
NULL
;
return
NULL
;
}
}
}
}
...
@@ -1680,8 +1679,7 @@ ast_for_expr(struct compiling *c, const node *n)
...
@@ -1680,8 +1679,7 @@ ast_for_expr(struct compiling *c, const node *n)
case
power
:
case
power
:
return
ast_for_power
(
c
,
n
);
return
ast_for_power
(
c
,
n
);
default:
default:
abort
();
PyErr_Format
(
PyExc_SystemError
,
"unhandled expr: %d"
,
TYPE
(
n
));
PyErr_Format
(
PyExc_Exception
,
"unhandled expr: %d"
,
TYPE
(
n
));
return
NULL
;
return
NULL
;
}
}
/* should never get here */
/* should never get here */
...
@@ -2131,7 +2129,7 @@ ast_for_flow_stmt(struct compiling *c, const node *n)
...
@@ -2131,7 +2129,7 @@ ast_for_flow_stmt(struct compiling *c, const node *n)
return
Raise
(
expr1
,
expr2
,
expr3
,
LINENO
(
n
));
return
Raise
(
expr1
,
expr2
,
expr3
,
LINENO
(
n
));
}
}
default:
default:
PyErr_Format
(
PyExc_
Exception
,
PyErr_Format
(
PyExc_
SystemError
,
"unexpected flow_stmt: %d"
,
TYPE
(
ch
));
"unexpected flow_stmt: %d"
,
TYPE
(
ch
));
return
NULL
;
return
NULL
;
}
}
...
@@ -2202,7 +2200,7 @@ alias_for_import_name(const node *n)
...
@@ -2202,7 +2200,7 @@ alias_for_import_name(const node *n)
case
STAR
:
case
STAR
:
return
alias
(
PyString_InternFromString
(
"*"
),
NULL
);
return
alias
(
PyString_InternFromString
(
"*"
),
NULL
);
default:
default:
PyErr_Format
(
PyExc_
Exception
,
PyErr_Format
(
PyExc_
SystemError
,
"unexpected import name: %d"
,
TYPE
(
n
));
"unexpected import name: %d"
,
TYPE
(
n
));
return
NULL
;
return
NULL
;
}
}
...
@@ -2304,7 +2302,7 @@ ast_for_import_stmt(struct compiling *c, const node *n)
...
@@ -2304,7 +2302,7 @@ ast_for_import_stmt(struct compiling *c, const node *n)
free_alias
(
mod
);
free_alias
(
mod
);
return
import
;
return
import
;
}
}
PyErr_Format
(
PyExc_
Exception
,
PyErr_Format
(
PyExc_
SystemError
,
"unknown import statement: starts with command '%s'"
,
"unknown import statement: starts with command '%s'"
,
STR
(
CHILD
(
n
,
0
)));
STR
(
CHILD
(
n
,
0
)));
return
NULL
;
return
NULL
;
...
@@ -2339,7 +2337,7 @@ ast_for_exec_stmt(struct compiling *c, const node *n)
...
@@ -2339,7 +2337,7 @@ ast_for_exec_stmt(struct compiling *c, const node *n)
expr_ty
expr1
,
globals
=
NULL
,
locals
=
NULL
;
expr_ty
expr1
,
globals
=
NULL
,
locals
=
NULL
;
int
n_children
=
NCH
(
n
);
int
n_children
=
NCH
(
n
);
if
(
n_children
!=
2
&&
n_children
!=
4
&&
n_children
!=
6
)
{
if
(
n_children
!=
2
&&
n_children
!=
4
&&
n_children
!=
6
)
{
PyErr_Format
(
PyExc_
Exception
,
PyErr_Format
(
PyExc_
SystemError
,
"poorly formed 'exec' statement: %d parts to statement"
,
"poorly formed 'exec' statement: %d parts to statement"
,
n_children
);
n_children
);
return
NULL
;
return
NULL
;
...
@@ -2387,7 +2385,7 @@ ast_for_assert_stmt(struct compiling *c, const node *n)
...
@@ -2387,7 +2385,7 @@ ast_for_assert_stmt(struct compiling *c, const node *n)
return
Assert
(
expr1
,
expr2
,
LINENO
(
n
));
return
Assert
(
expr1
,
expr2
,
LINENO
(
n
));
}
}
PyErr_Format
(
PyExc_
Exception
,
PyErr_Format
(
PyExc_
SystemError
,
"improper number of parts to 'assert' statement: %d"
,
"improper number of parts to 'assert' statement: %d"
,
NCH
(
n
));
NCH
(
n
));
return
NULL
;
return
NULL
;
...
@@ -2574,7 +2572,7 @@ ast_for_if_stmt(struct compiling *c, const node *n)
...
@@ -2574,7 +2572,7 @@ ast_for_if_stmt(struct compiling *c, const node *n)
orelse
,
LINENO
(
n
));
orelse
,
LINENO
(
n
));
}
}
else
{
else
{
PyErr_Format
(
PyExc_
Exception
,
PyErr_Format
(
PyExc_
SystemError
,
"unexpected token in 'if' statement: %s"
,
s
);
"unexpected token in 'if' statement: %s"
,
s
);
return
NULL
;
return
NULL
;
}
}
...
@@ -2615,7 +2613,7 @@ ast_for_while_stmt(struct compiling *c, const node *n)
...
@@ -2615,7 +2613,7 @@ ast_for_while_stmt(struct compiling *c, const node *n)
return
While
(
expression
,
seq1
,
seq2
,
LINENO
(
n
));
return
While
(
expression
,
seq1
,
seq2
,
LINENO
(
n
));
}
}
else
{
else
{
PyErr_Format
(
PyExc_
Exception
,
PyErr_Format
(
PyExc_
SystemError
,
"wrong number of tokens for 'while' statement: %d"
,
"wrong number of tokens for 'while' statement: %d"
,
NCH
(
n
));
NCH
(
n
));
return
NULL
;
return
NULL
;
...
@@ -2702,7 +2700,7 @@ ast_for_except_clause(struct compiling *c, const node *exc, node *body)
...
@@ -2702,7 +2700,7 @@ ast_for_except_clause(struct compiling *c, const node *exc, node *body)
return
excepthandler
(
expression
,
e
,
suite_seq
);
return
excepthandler
(
expression
,
e
,
suite_seq
);
}
}
else
{
else
{
PyErr_Format
(
PyExc_
Exception
,
PyErr_Format
(
PyExc_
SystemError
,
"wrong number of children for 'except' clause: %d"
,
"wrong number of children for 'except' clause: %d"
,
NCH
(
exc
));
NCH
(
exc
));
return
NULL
;
return
NULL
;
...
@@ -2847,7 +2845,7 @@ ast_for_stmt(struct compiling *c, const node *n)
...
@@ -2847,7 +2845,7 @@ ast_for_stmt(struct compiling *c, const node *n)
case
assert_stmt
:
case
assert_stmt
:
return
ast_for_assert_stmt
(
c
,
n
);
return
ast_for_assert_stmt
(
c
,
n
);
default:
default:
PyErr_Format
(
PyExc_
Exception
,
PyErr_Format
(
PyExc_
SystemError
,
"unhandled small_stmt: TYPE=%d NCH=%d
\n
"
,
"unhandled small_stmt: TYPE=%d NCH=%d
\n
"
,
TYPE
(
n
),
NCH
(
n
));
TYPE
(
n
),
NCH
(
n
));
return
NULL
;
return
NULL
;
...
@@ -2873,7 +2871,7 @@ ast_for_stmt(struct compiling *c, const node *n)
...
@@ -2873,7 +2871,7 @@ ast_for_stmt(struct compiling *c, const node *n)
case
classdef
:
case
classdef
:
return
ast_for_classdef
(
c
,
ch
);
return
ast_for_classdef
(
c
,
ch
);
default:
default:
PyErr_Format
(
PyExc_
Exception
,
PyErr_Format
(
PyExc_
SystemError
,
"unhandled small_stmt: TYPE=%d NCH=%d
\n
"
,
"unhandled small_stmt: TYPE=%d NCH=%d
\n
"
,
TYPE
(
n
),
NCH
(
n
));
TYPE
(
n
),
NCH
(
n
));
return
NULL
;
return
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