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
3583761b
Commit
3583761b
authored
Apr 19, 2013
by
R David Murray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#17413: make sure settrace funcs get passed exception instances for 'value'.
Patch by Ingrid Cheung and Brendan McLoughlin.
parent
0aa685a3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
0 deletions
+30
-0
Lib/test/test_sys_settrace.py
Lib/test/test_sys_settrace.py
+23
-0
Misc/ACKS
Misc/ACKS
+2
-0
Misc/NEWS
Misc/NEWS
+4
-0
Python/ceval.c
Python/ceval.c
+1
-0
No files found.
Lib/test/test_sys_settrace.py
View file @
3583761b
...
@@ -458,6 +458,29 @@ class RaisingTraceFuncTestCase(unittest.TestCase):
...
@@ -458,6 +458,29 @@ class RaisingTraceFuncTestCase(unittest.TestCase):
self
.
fail
(
"exception not propagated"
)
self
.
fail
(
"exception not propagated"
)
def
test_exception_arguments
(
self
):
def
f
():
x
=
0
# this should raise an error
x
.
no_such_attr
def
g
(
frame
,
event
,
arg
):
if
(
event
==
'exception'
):
type
,
exception
,
trace
=
arg
self
.
assertIsInstance
(
exception
,
Exception
)
return
g
existing
=
sys
.
gettrace
()
try
:
sys
.
settrace
(
g
)
try
:
f
()
except
AttributeError
:
# this is expected
pass
finally
:
sys
.
settrace
(
existing
)
# 'Jump' tests: assigning to frame.f_lineno within a trace function
# 'Jump' tests: assigning to frame.f_lineno within a trace function
# moves the execution position - it's how debuggers implement a Jump
# moves the execution position - it's how debuggers implement a Jump
# command (aka. "Set next statement").
# command (aka. "Set next statement").
...
...
Misc/ACKS
View file @
3583761b
...
@@ -208,6 +208,7 @@ David Chaum
...
@@ -208,6 +208,7 @@ David Chaum
Nicolas Chauvat
Nicolas Chauvat
Jerry Chen
Jerry Chen
Michael Chermside
Michael Chermside
Ingrid Cheung
Albert Chin-A-Young
Albert Chin-A-Young
Adal Chiriliuc
Adal Chiriliuc
Matt Chisholm
Matt Chisholm
...
@@ -786,6 +787,7 @@ Chris McDonough
...
@@ -786,6 +787,7 @@ Chris McDonough
Greg McFarlane
Greg McFarlane
Alan McIntyre
Alan McIntyre
Michael McLay
Michael McLay
Brendan McLoughlin
Mark Mc Mahon
Mark Mc Mahon
Gordon McMillan
Gordon McMillan
Andrew McNamara
Andrew McNamara
...
...
Misc/NEWS
View file @
3583761b
...
@@ -12,6 +12,10 @@ What's New in Python 3.3.2?
...
@@ -12,6 +12,10 @@ What's New in Python 3.3.2?
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #17413: sys.settrace callbacks were being passed a string instead of an
exception instance for the '
value
' element of the arg tuple if the exception
originated from C code; now an exception instance is always provided.
- Issue #17782: Fix undefined behaviour on platforms where
- Issue #17782: Fix undefined behaviour on platforms where
``struct timespec``'
s
"tv_nsec"
member
is
not
a
C
long
.
``struct timespec``'
s
"tv_nsec"
member
is
not
a
C
long
.
...
...
Python/ceval.c
View file @
3583761b
...
@@ -3712,6 +3712,7 @@ call_exc_trace(Py_tracefunc func, PyObject *self, PyFrameObject *f)
...
@@ -3712,6 +3712,7 @@ call_exc_trace(Py_tracefunc func, PyObject *self, PyFrameObject *f)
value
=
Py_None
;
value
=
Py_None
;
Py_INCREF
(
value
);
Py_INCREF
(
value
);
}
}
PyErr_NormalizeException
(
&
type
,
&
value
,
&
traceback
);
arg
=
PyTuple_Pack
(
3
,
type
,
value
,
traceback
);
arg
=
PyTuple_Pack
(
3
,
type
,
value
,
traceback
);
if
(
arg
==
NULL
)
{
if
(
arg
==
NULL
)
{
PyErr_Restore
(
type
,
value
,
traceback
);
PyErr_Restore
(
type
,
value
,
traceback
);
...
...
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