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
fb2515af
Commit
fb2515af
authored
Jul 17, 2015
by
Rudi Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use weakref's original tp_dealloc.
parent
22b388e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
12 deletions
+5
-12
from_cpython/Objects/weakrefobject.c
from_cpython/Objects/weakrefobject.c
+3
-1
src/runtime/types.cpp
src/runtime/types.cpp
+2
-11
No files found.
from_cpython/Objects/weakrefobject.c
View file @
fb2515af
...
@@ -544,7 +544,9 @@ proxy_dealloc(PyWeakReference *self)
...
@@ -544,7 +544,9 @@ proxy_dealloc(PyWeakReference *self)
if
(
self
->
wr_callback
!=
NULL
)
if
(
self
->
wr_callback
!=
NULL
)
PyObject_GC_UnTrack
((
PyObject
*
)
self
);
PyObject_GC_UnTrack
((
PyObject
*
)
self
);
clear_weakref
(
self
);
clear_weakref
(
self
);
PyObject_GC_Del
(
self
);
// Pyston change: we monkey-patch this function to use the Pyston GC
// Shouldn't need to call tp_free either.
// PyObject_GC_Del(self);
}
}
/* sequence slots */
/* sequence slots */
...
...
src/runtime/types.cpp
View file @
fb2515af
...
@@ -1152,11 +1152,6 @@ static void proxy_to_tp_traverse(GCVisitor* v, Box* b) {
...
@@ -1152,11 +1152,6 @@ static void proxy_to_tp_traverse(GCVisitor* v, Box* b) {
b
->
cls
->
tp_traverse
(
b
,
call_gc_visit
,
v
);
b
->
cls
->
tp_traverse
(
b
,
call_gc_visit
,
v
);
}
}
static
void
proxy_to_tp_clear
(
Box
*
b
)
{
assert
(
b
->
cls
->
tp_clear
);
b
->
cls
->
tp_clear
(
b
);
}
// This probably belongs in tuple.cpp?
// This probably belongs in tuple.cpp?
extern
"C"
void
tupleGCHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
extern
"C"
void
tupleGCHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGCHandler
(
v
,
b
);
boxGCHandler
(
v
,
b
);
...
@@ -2932,15 +2927,11 @@ extern "C" PyUnicodeObject* _PyUnicode_New(Py_ssize_t length) noexcept {
...
@@ -2932,15 +2927,11 @@ extern "C" PyUnicodeObject* _PyUnicode_New(Py_ssize_t length) noexcept {
}
}
// Normally we don't call the Python tp_ slots that are present to support
// Normally we don't call the Python tp_ slots that are present to support
// CPython's reference-counted garbage collection. However, for a few types
// CPython's reference-counted garbage collection.
// like weak references, we still rely on reference-counting to some extent.
static
void
setTypeGCProxy
(
BoxedClass
*
cls
)
{
static
void
setTypeGCProxy
(
BoxedClass
*
cls
)
{
cls
->
tp_alloc
=
PystonType_GenericAlloc
;
cls
->
tp_alloc
=
PystonType_GenericAlloc
;
cls
->
tp_free
=
default_free
;
cls
->
gc_visit
=
proxy_to_tp_traverse
;
cls
->
gc_visit
=
proxy_to_tp_traverse
;
// We can't use the original tp_dealloc here, the dealloc method of some
// types like ProxyType explicitely frees itself without using tp_free.
cls
->
tp_dealloc
=
proxy_to_tp_clear
;
cls
->
has_safe_tp_dealloc
=
true
;
cls
->
has_safe_tp_dealloc
=
true
;
cls
->
is_pyston_class
=
true
;
cls
->
is_pyston_class
=
true
;
}
}
...
...
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