Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Boxiang Sun
Pyston
Commits
615d5702
Commit
615d5702
authored
Apr 11, 2016
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
I guess our functions need clears now
parent
ba857499
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
src/runtime/types.cpp
src/runtime/types.cpp
+21
-2
test/tests/refcounting_regression_test.py
test/tests/refcounting_regression_test.py
+0
-1
No files found.
src/runtime/types.cpp
View file @
615d5702
...
...
@@ -410,7 +410,7 @@ static void functionDtor(Box* b) {
self
->
clearAttrsForDealloc
();
Py_DECREF
(
self
->
doc
);
Py_
X
DECREF
(
self
->
doc
);
Py_XDECREF
(
self
->
modname
);
Py_XDECREF
(
self
->
name
);
Py_XDECREF
(
self
->
closure
);
...
...
@@ -442,6 +442,25 @@ static int func_traverse(BoxedFunction* f, visitproc visit, void* arg) noexcept
return
0
;
}
static
int
func_clear
(
Box
*
b
)
noexcept
{
assert
(
isSubclass
(
b
->
cls
,
function_cls
));
BoxedFunction
*
f
=
static_cast
<
BoxedFunction
*>
(
b
);
Py_CLEAR
(
f
->
globals
);
Py_CLEAR
(
f
->
modname
);
Py_CLEAR
(
f
->
defaults
);
Py_CLEAR
(
f
->
doc
);
Py_CLEAR
(
f
->
name
);
Py_CLEAR
(
f
->
closure
);
// I think it's ok to not clear the parent_module?
b
->
clearAttrsForDealloc
();
return
0
;
}
static
int
builtin_func_traverse
(
BoxedBuiltinFunctionOrMethod
*
f
,
visitproc
visit
,
void
*
arg
)
noexcept
{
// Py_VISIT(f->func_code);
Py_VISIT
(
f
->
globals
);
...
...
@@ -4241,7 +4260,7 @@ void setupRuntime() {
BoxedClass
(
object_cls
,
0
,
0
,
sizeof
(
BoxedFloat
),
false
,
"float"
,
true
,
BoxedFloat
::
tp_dealloc
,
NULL
,
false
);
function_cls
=
new
(
0
)
BoxedClass
(
object_cls
,
offsetof
(
BoxedFunction
,
attrs
),
offsetof
(
BoxedFunction
,
weakreflist
),
sizeof
(
BoxedFunction
),
false
,
"function"
,
false
,
functionDtor
,
NULL
,
true
,
(
traverseproc
)
func_traverse
,
NOCLEAR
);
(
traverseproc
)
func_traverse
,
func_clear
);
builtin_function_or_method_cls
=
new
(
0
)
BoxedClass
(
object_cls
,
0
,
offsetof
(
BoxedBuiltinFunctionOrMethod
,
weakreflist
),
sizeof
(
BoxedBuiltinFunctionOrMethod
),
false
,
"builtin_function_or_method"
,
false
,
functionDtor
,
NULL
,
true
,
(
traverseproc
)
builtin_func_traverse
,
NOCLEAR
);
...
...
test/tests/refcounting_regression_test.py
View file @
615d5702
# expected: reffail
# Random regression test from implementing refcounting:
def
f
():
...
...
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