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
d295f120
Commit
d295f120
authored
Apr 09, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make first raise argument optional
parent
926f13a0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
9 deletions
+26
-9
Grammar/Grammar
Grammar/Grammar
+1
-1
Python/ceval.c
Python/ceval.c
+12
-0
Python/compile.c
Python/compile.c
+10
-6
Python/graminit.c
Python/graminit.c
+3
-2
No files found.
Grammar/Grammar
View file @
d295f120
...
...
@@ -40,7 +40,7 @@ flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt
break_stmt: 'break'
continue_stmt: 'continue'
return_stmt: 'return' [testlist]
raise_stmt: 'raise'
test [',' test [',' test
]]
raise_stmt: 'raise'
[test [',' test [',' test]
]]
import_stmt: 'import' dotted_name (',' dotted_name)* | 'from' dotted_name 'import' ('*' | NAME (',' NAME)*)
dotted_name: NAME ('.' NAME)*
global_stmt: 'global' NAME (',' NAME)*
...
...
Python/ceval.c
View file @
d295f120
...
...
@@ -1090,6 +1090,7 @@ eval_code2(co, globals, locals,
/* Fallthrough */
case
1
:
w
=
POP
();
/* exc */
case
0
:
/* Fallthrough */
why
=
do_raise
(
w
,
v
,
u
);
break
;
default:
...
...
@@ -1967,6 +1968,17 @@ static enum why_code
do_raise
(
type
,
value
,
tb
)
PyObject
*
type
,
*
value
,
*
tb
;
{
if
(
type
==
NULL
)
{
/* Reraise */
PyThreadState
*
tstate
=
PyThreadState_Get
();
type
=
tstate
->
exc_type
==
NULL
?
Py_None
:
tstate
->
exc_type
;
value
=
tstate
->
exc_value
;
tb
=
tstate
->
exc_traceback
;
Py_XINCREF
(
type
);
Py_XINCREF
(
value
);
Py_XINCREF
(
tb
);
}
/* We support the following forms of raise:
raise <class>, <classinstance>
raise <class>, <argument tuple>
...
...
Python/compile.c
View file @
d295f120
...
...
@@ -659,6 +659,8 @@ com_add(c, list, v)
{
int
n
=
PyList_Size
(
list
);
int
i
;
/* XXX This is quadratic in the number of names per compilation unit.
XXX Should use a dictionary. */
for
(
i
=
n
;
--
i
>=
0
;
)
{
PyObject
*
w
=
PyList_GetItem
(
list
,
i
);
if
(
v
->
ob_type
==
w
->
ob_type
&&
PyObject_Compare
(
v
,
w
)
==
0
)
...
...
@@ -2050,13 +2052,15 @@ com_raise_stmt(c, n)
node
*
n
;
{
int
i
;
REQ
(
n
,
raise_stmt
);
/* 'raise' test [',' test [',' test]] */
REQ
(
n
,
raise_stmt
);
/* 'raise' [test [',' test [',' test]]] */
if
(
NCH
(
n
)
>
1
)
{
com_node
(
c
,
CHILD
(
n
,
1
));
if
(
NCH
(
n
)
>
3
)
{
com_node
(
c
,
CHILD
(
n
,
3
));
if
(
NCH
(
n
)
>
5
)
com_node
(
c
,
CHILD
(
n
,
5
));
}
}
i
=
NCH
(
n
)
/
2
;
com_addoparg
(
c
,
RAISE_VARARGS
,
i
);
com_pop
(
c
,
i
);
...
...
Python/graminit.c
View file @
d295f120
...
...
@@ -331,8 +331,9 @@ static state states_18[3] = {
static
arc
arcs_19_0
[
1
]
=
{
{
48
,
1
},
};
static
arc
arcs_19_1
[
1
]
=
{
static
arc
arcs_19_1
[
2
]
=
{
{
21
,
2
},
{
0
,
1
},
};
static
arc
arcs_19_2
[
2
]
=
{
{
22
,
3
},
...
...
@@ -353,7 +354,7 @@ static arc arcs_19_6[1] = {
};
static
state
states_19
[
7
]
=
{
{
1
,
arcs_19_0
},
{
1
,
arcs_19_1
},
{
2
,
arcs_19_1
},
{
2
,
arcs_19_2
},
{
1
,
arcs_19_3
},
{
2
,
arcs_19_4
},
...
...
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