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
46aea656
Commit
46aea656
authored
Jun 04, 2016
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #20041: Fixed TypeError when frame.f_trace is set to None.
Patch by Xavier de Gaye.
parent
2fedf704
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
5 deletions
+15
-5
Lib/test/test_sys_settrace.py
Lib/test/test_sys_settrace.py
+9
-0
Misc/NEWS
Misc/NEWS
+3
-0
Objects/frameobject.c
Objects/frameobject.c
+3
-5
No files found.
Lib/test/test_sys_settrace.py
View file @
46aea656
...
...
@@ -388,6 +388,15 @@ class TraceTestCase(unittest.TestCase):
(
257
,
'line'
),
(
257
,
'return'
)])
def
test_17_none_f_trace
(
self
):
# Issue 20041: fix TypeError when f_trace is set to None.
def
func
():
sys
.
_getframe
().
f_trace
=
None
lineno
=
2
self
.
run_and_compare
(
func
,
[(
0
,
'call'
),
(
1
,
'line'
)])
class
RaisingTraceFuncTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
Misc/NEWS
View file @
46aea656
...
...
@@ -10,6 +10,9 @@ Release date: tba
Core and Builtins
-----------------
- Issue #20041: Fixed TypeError when frame.f_trace is set to None.
Patch by Xavier de Gaye.
- Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N"
format unit.
...
...
Objects/frameobject.c
View file @
46aea656
...
...
@@ -349,15 +349,13 @@ frame_gettrace(PyFrameObject *f, void *closure)
static
int
frame_settrace
(
PyFrameObject
*
f
,
PyObject
*
v
,
void
*
closure
)
{
PyObject
*
old_value
;
/* We rely on f_lineno being accurate when f_trace is set. */
f
->
f_lineno
=
PyFrame_GetLineNumber
(
f
);
old_value
=
f
->
f_trace
;
if
(
v
==
Py_None
)
v
=
NULL
;
Py_XINCREF
(
v
);
f
->
f_trace
=
v
;
Py_XDECREF
(
old_value
);
Py_XSETREF
(
f
->
f_trace
,
v
);
return
0
;
}
...
...
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