Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
a11d92eb
Commit
a11d92eb
authored
Nov 23, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
merge 0.19.x branch into master
parents
8f641227
a6195f1a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
20 deletions
+25
-20
Cython/Utility/Exceptions.c
Cython/Utility/Exceptions.c
+2
-20
tests/run/reraise_3args.pyx
tests/run/reraise_3args.pyx
+23
-0
No files found.
Cython/Utility/Exceptions.c
View file @
a11d92eb
...
...
@@ -135,7 +135,6 @@ raise_error:
#else
/* Python 3+ */
static
void
__Pyx_Raise
(
PyObject
*
type
,
PyObject
*
value
,
PyObject
*
tb
,
PyObject
*
cause
)
{
PyObject
*
owned_instance
=
NULL
;
if
(
tb
==
Py_None
)
{
tb
=
0
;
}
else
if
(
tb
&&
!
PyTraceBack_Check
(
tb
))
{
...
...
@@ -143,11 +142,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
"raise: arg 3 must be a traceback or None"
);
goto
bad
;
}
if
(
value
==
Py_None
)
value
=
0
;
if
(
PyExceptionInstance_Check
(
type
))
{
if
(
value
)
{
if
(
value
&&
value
!=
Py_None
)
{
PyErr_SetString
(
PyExc_TypeError
,
"instance exception may not have a separate value"
);
goto
bad
;
...
...
@@ -156,21 +153,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
type
=
(
PyObject
*
)
Py_TYPE
(
value
);
}
else
if
(
PyExceptionClass_Check
(
type
))
{
// instantiate the type now (we don't know when and how it will be caught)
PyObject
*
args
;
if
(
!
value
)
args
=
PyTuple_New
(
0
);
else
if
(
PyTuple_Check
(
value
))
{
Py_INCREF
(
value
);
args
=
value
;
}
else
args
=
PyTuple_Pack
(
1
,
value
);
if
(
!
args
)
goto
bad
;
owned_instance
=
PyEval_CallObject
(
type
,
args
);
Py_DECREF
(
args
);
if
(
!
owned_instance
)
goto
bad
;
value
=
owned_instance
;
PyErr_NormalizeException
(
&
type
,
&
value
,
&
tb
);
if
(
!
PyExceptionInstance_Check
(
value
))
{
PyErr_Format
(
PyExc_TypeError
,
"calling %R should have returned an instance of "
...
...
@@ -222,7 +205,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
}
bad:
Py_XDECREF
(
owned_instance
);
return
;
}
#endif
...
...
tests/run/reraise_3args.pyx
0 → 100644
View file @
a11d92eb
import
sys
class
MyError
(
Exception
):
def
__init__
(
self
,
name
,
var
):
self
.
name
=
name
self
.
var
=
var
def
reraise_explicitly
():
"""
>>> try: reraise_explicitly()
... except MyError: print("RAISED!")
... else: print("NOT RAISED!")
RAISED!
"""
try
:
raise
MyError
(
'Oh no!'
,
42
)
except
MyError
:
tmp
=
sys
.
exc_info
()
raise
tmp
[
0
],
tmp
[
1
],
tmp
[
2
]
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