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
4c889011
Commit
4c889011
authored
May 08, 2001
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SF patch 419176 from MvL; fixed bug 418977
Two errors in dict_to_map() helper used by PyFrame_LocalsToFast().
parent
d37292bb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
6 deletions
+24
-6
Lib/test/output/test_scope
Lib/test/output/test_scope
+1
-0
Lib/test/test_scope.py
Lib/test/test_scope.py
+20
-0
Objects/frameobject.c
Objects/frameobject.c
+3
-6
No files found.
Lib/test/output/test_scope
View file @
4c889011
...
...
@@ -18,3 +18,4 @@ test_scope
17. class and global
18. verify that locals() works
19. var is bound and free in class
20. interaction with trace function
Lib/test/test_scope.py
View file @
4c889011
...
...
@@ -447,3 +447,23 @@ def f(x):
inst
=
f
(
3
)()
verify
(
inst
.
a
==
inst
.
m
())
print
"20. interaction with trace function"
import
sys
def
tracer
(
a
,
b
,
c
):
return
tracer
def
adaptgetter
(
name
,
klass
,
getter
):
kind
,
des
=
getter
if
kind
==
1
:
# AV happens when stepping from this line to next
if
des
==
""
:
des
=
"_%s__%s"
%
(
klass
.
__name__
,
name
)
return
lambda
obj
:
getattr
(
obj
,
des
)
class
TestClass
:
pass
sys
.
settrace
(
tracer
)
adaptgetter
(
"foo"
,
TestClass
,
(
1
,
""
))
sys
.
settrace
(
None
)
Objects/frameobject.c
View file @
4c889011
...
...
@@ -283,12 +283,9 @@ dict_to_map(PyObject *map, int nmap, PyObject *dict, PyObject **values,
PyObject
*
value
=
PyDict_GetItem
(
dict
,
key
);
Py_XINCREF
(
value
);
if
(
deref
)
{
if
(
value
)
{
if
(
value
||
clear
)
{
if
(
PyCell_Set
(
values
[
j
],
value
)
<
0
)
PyErr_Clear
();
}
else
if
(
clear
)
{
Py_XDECREF
(
values
[
j
]);
values
[
j
]
=
value
;
}
}
else
if
(
value
!=
NULL
||
clear
)
{
Py_XDECREF
(
values
[
j
]);
...
...
@@ -370,10 +367,10 @@ PyFrame_LocalsToFast(PyFrameObject *f, int clear)
return
;
dict_to_map
(
f
->
f_code
->
co_cellvars
,
PyTuple_GET_SIZE
(
f
->
f_code
->
co_cellvars
),
locals
,
fast
,
1
,
clear
);
locals
,
fast
+
f
->
f_nlocals
,
1
,
clear
);
dict_to_map
(
f
->
f_code
->
co_freevars
,
PyTuple_GET_SIZE
(
f
->
f_code
->
co_freevars
),
locals
,
fast
,
1
,
clear
);
locals
,
fast
+
f
->
f_nlocals
+
f
->
f_ncells
,
1
,
clear
);
}
PyErr_Restore
(
error_type
,
error_value
,
error_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